Changes the instance type or modifies the Internet bandwidth of a Pay-As-You-Go () instance.

Description

When you call this interface, consider the following:

  • The instance cannot have overdue payment.

  • You can only modify the Internet bandwidth when the ECS instance is Running (Running) or  Stopped (Stopped).

  • Before upgrading or lowering the instance specification, you can use DescribeResourcesModification to query the current instance for instance specifications that support variant matches.

  • You can only change the instance type when the ECS instance is Stopped (Stopped).

  • You can only either change the instance type or modify the Internet bandwidth each time.

  • n instance that was successfully modified once cannot be modified again within 5 minutes.

Request parameters

Name Type Required Description
Action String Yes The name of this interface. Value: ModifyInstanceSpec
InstanceId String Yes The specified instance ID.
InstanceType String No Instance type. For more information, see Instance generations and type families, or call DescribeInstanceTypes to obtain the latest type list. 
InternetMaxBandwidthOut Integer No Maximum value of public network outbound bandwidth; unit: Mbps (Megabit per second). Optional values:
  • PayByTraffic: [0,100]
InternetMaxBandwidthIn Integer No Maximum value of inbound Internet bandwidth, in Mbps (Megabit per second).  Value range:
  • Pay-By-Traffic: [1, 200]
ClientToken  String No Used to guarantee the idempotence of the request. The value is generated by a client. It must be unique among all requests and contains a maximum of 64 ASCII characters. For more information, see How to ensure idempotence.

Return parameters

Name Type Description
RequestId String The Request ID.

Example

Request example
https://ecs.aliyuncs.com/?Action=ModifyInstanceSpec
&InstanceId=i-xxxxx1
&InstanceType=ecs.s1.large
&InternetMaxBandwidthOut=10
&InternetMaxBandwidthIn=100
&ClientToken=xxxxxxxxx
&<common request parameters>
Response sample

XML format

<ModifyInstanceSpecResponse>
   <RequestId>04F0F334-1335-436C-A1D7-6C044FE73368</RequestId>
</ModifyInstanceSpecResponse>
JSON format
{
   "RequestId": "04F0F334-1335-436C-A1D7-6C044FE73368",
}

Error codes

Error codes specific to this interface are as follows. For more error codes, see API Error Center.

Error code Error message HTTP status code  Note
Account.Arrearage Your account has an outstanding payment. 400 Your account has an overdue payment.
DependencyViolation.InstanceType The current InstanceType cannot be changed to the specified InstanceType. 400 You cannot change the instance type to the specified instance type.
IdempotenceParamNotMatch Request uses a client token in a previous request but is not  identical to that request. 400 The request parameters for the same ClientToken do not match.
InvalidClientToken.ValueNotSupported The ClientToken provided is invalid. 400 The value of ClientToken  is invalid. Only ASCII characters are valid.
InvalidInstance.UnpaidOrder The specified instance has unpaid order. 400 The current instance has unpaid orders.
InvalidInstanceType.ValueNotSupported The specified InstanceType is not supported. 400 The specified InstanceType is invalid or does not exist.
InvalidInstanceType.ValueUnauthorized The specified instancetype is not authorized. 400 The specified InstanceType  is not authorized for use.
InvalidInternetChargeType.ValueNotSupported The specified InternetChargeType is not valid. 400 The specified InternetChargeType does not exist.
InvalidParameter The specified parameter InternetMaxBandwidthOut is not valid. 400 The specified InternetMaxBandwidthOut is invalid (it is not a number or a number out of value range).
InvalidParameter.Bandwidth The specified parameter Bandwidth is not valid. 400 The specified bandwidth value is invalid.
InvalidParameter.Conflict The specified image does not support the specified instance type. 400 The image is not allowed to be used on an instance of the specified InstanceType.
InvalidParameter.Mismatch Too many parameters in one request. 400 Request parameters are excessive.
InvalidStatus.ValueNotSupported The current status of the resource does not support this operation. 400 The status of the instance does not support this operation.
InvalidStatus.ValueNotSupported The instance cannot be modified in the specified status. 400 The current instance status does not support this operation.
OperationDenied The specified instance is in VPC. 400 The network type of the instance is VPC.
Price.PricePlanResultNotFound The internetMaxBandwidthIn or internetMaxBandwidthOut provided is invalid. 400 The specified parameter InternetMaxBandwidthIn or  InternetMaxBandwidthOut is invalid.
Throttling  You have made too many requests within a short time; your request is denied due to request throttling. 400 Too many requests were sent.
InvalidInstanceStatus.NotStopped The specified Instance status is not stopped. 400 The instance is not in the Stopped status.
CategoryViolation The specified instance does not support this operation because of its disk category. 403 The network type of the current instance does not support this operation.
ChargeTypeViolation The operation is not permitted due to charge type of the instance. 403 The billing method of the instance does not support this operation.
 Imagenotsupportinstancetype  pecified image does not support the specified InstanceType. 403 The instance type is not supported for the specified mirror.
InstanceLockedForSecurity The input parameter InstanceId that is mandatory for processing this  security reasons. 403 The instance is currently locked down and the operation is denied.
InvalidAccountStatus.NotEnoughBalance Your account does not have enough balance. 403 Your registered credit card is invalid or you have insufficient balance in your PayPal account.
LastTokenProcessing The last token request is processing.  403 The last request is still in process.
OperationDenied The instance is out of usage. 403 The specified instance type has insufficient inventory.
InvalidInstanceId.NotFound The specified InstanceId does not exist. 404 The specified InstanceId does not exist.
InternalError The request processing has failed due to some unknown error, exception or failure.  500 Internal error.
InvalidAction The specified action is not valid. 500  The current operation is invalid.