Changes the instance type and public bandwidth of a pay-as-you-go instance.

Description

For information about how to use SDK for Python to change resource configurations, see Query available resources for configuration changes.

When you call this operation, take note of the following items:

  • Make sure that you have no overdue payments in your account.
  • You can adjust the public bandwidth of an instance only when the instance is in the Running or Stopped state.
  • Before you change the instance type of a pay-as-you-go instance, call the DescribeResourcesModification operation to check for compatible instance types.
  • You can change the instance type of an instance only when the instance is in the Stopped state.
  • Each operation lets you change only one configuration at a time: the instance type or the public bandwidth.
  • As of November 27, 2020, the total bandwidth available for all instances (new and modified) is subject to the throttling poiicy of your account. To increase the maximum bandwidth value, submit a ticket. The following throttling policies apply:
    • Within a single region, the sum of actual peak bandwidths of all ECS instances that use the pay-by-traffic metering method for network usage cannot exceed 5 Gbit/s.
    • Within a single region, the sum of actual peak bandwidths of all ECS instances that use the pay-by-bandwidth metering method for network usage cannot exceed 50 Gbit/s.

Debugging

OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer. OpenAPI Explorer dynamically generates the sample code of the operation for different SDKs.

Request parameters

ParameterTypeRequiredExampleDescription
ActionStringYesModifyInstanceSpec

The operation that you want to perform. Set the value to ModifyInstanceSpec.

InstanceIdStringYesi-bp67acfmxazb4p****

The ID of the instance.

InstanceTypeStringNoecs.g6.large

The new instance type. For more information, see Instance families or call the DescribeInstanceTypes operation to query the most recent instance type list.

InternetMaxBandwidthOutIntegerNo10

The maximum outbound public bandwidth. Unit: Mbit/s. Valid values: 0 to 100.

Note When the pay-by-traffic metering method is used, the maximum inbound and outbound bandwidth values are used as the upper limits for bandwidth instead of guaranteed performance specifications. In scenarios where demand outstrips available resources, the instance may not achieve these limits. If you want guaranteed bandwidth for your instance, we recommend that you use the pay-by-bandwidth metering method.
InternetMaxBandwidthInIntegerNo10

The maximum inbound public bandwidth. Unit: Mbit/s. Valid values:

  • When the purchased outbound public bandwidth is less than or equal to 10 Mbit/s, the valid values of this parameter are 1 to 10 and the default value is 10.
  • When the purchased outbound public bandwidth is greater than 10 Mbit/s, the valid values of this parameter are 1 to the InternetMaxBandwidthOut value and the default value is the InternetMaxBandwidthOut value.
Note When the pay-by-traffic metering method is used, the maximum inbound and outbound bandwidth values are used as the upper limits for bandwidth instead of guaranteed performance specifications. In scenarios where demand outstrips available resources, the instance may not achieve these limits. If you want guaranteed bandwidth for your instance, we recommend that you use the pay-by-bandwidth metering method.
Temporary.StartTimeStringNohide
Note This parameter is in invitational preview and is unavailable for public use.
Temporary.EndTimeStringNohide
Note This parameter is in invitational preview and is unavailable for public use.
Temporary.InternetMaxBandwidthOutIntegerNo0
Note This parameter is in invitational preview and is unavailable for public use.
AsyncBooleanNofalse

Specifies whether to submit an asynchronous request.

Default value: false.

AllowMigrateAcrossZoneBooleanNofalse

Specifies whether to support cross-cluster instance type upgrades.

Default value: false.

When AllowMigrateAcrossZone is set to true and you upgrade the instance configurations based on the returned information, take note of the following items:

Instances of the classic network type:

  • For retired instance types, when a non-I/O optimized instance is upgraded to an I/O optimized instance, the private IP address, disk device names, and software license codes of the instance are changed. For more information, see Retired instance types. For Linux instances, device names of basic disks (cloud) are changed to the form of xvda or xvdb, while device names of ultra disks (cloud_efficiency) and standard SSDs (cloud_ssd) are changed to the form of vda or vdb.
  • For instance families available for purchase, when the instance type of an instance is changed, the private IP address of the instance changes. For more information, see Instance families.

Instances that reside in virtual private clouds (VPCs): For retired instance types, when a non-I/O-optimized instance is upgraded to an I/O-optimized instance, the disk device names and software authorization codes of the instance change. For more information, see Retired instance types. For Linux instances, device names of basic disks (cloud) are changed to the form of xvda or xvdb, while device names of ultra disks (cloud_efficiency) and standard SSDs (cloud_ssd) are changed to the form of vda or vdb.

SystemDisk.CategoryStringNocloud_ssd

The new category of the system disk. This parameter is valid only when you upgrade an instance from a retired instance type to an available instance type or upgrade a non-I/O optimized instance to an I/O optimized instance. For more information, see Retired instance types and Instance families. Valid values:

  • cloud_efficiency: ultra disk.
  • cloud_ssd: standard SSD
ClientTokenStringNo0c593ea1-3bea-11e9-b96b-88e9fe637760

The client token that is used to ensure the idempotence of the request. You can use the client to generate a client token. Make sure that a unique client token is used for each request. The ClientToken value can contain only ASCII characters and cannot exceed 64 characters in length. For more information, see How to ensure idempotence.

Response parameters

ParameterTypeExampleDescription
RequestIdString473469C7-AA6F-4DC5-B3DB-A3DC0DE3C83E

The ID of the request.

Examples

Sample requests

https://ecs.aliyuncs.com/?Action=ModifyInstanceSpec
&InstanceId=i-bp67acfmxazb4p****
&InstanceType=ecs.g6.large
&InternetMaxBandwidthOut=10
&ClientToken=0c593ea1-3bea-11e9-b96b-88e9fe637760
&<Common request parameters>

Sample success response

XML format

HTTP/1.1 200 OK
Content-Type:application/xml

<ModifyInstanceSpecResponse>
   <RequestId>04F0F334-1335-436C-A1D7-6C044FE73368</RequestId>
</ModifyInstanceSpecResponse>

JSON format

HTTP/1.1 200 OK
Content-Type:application/json

{
  "RequestId" : "04F0F334-1335-436C-A1D7-6C044FE73368"
}

Error codes

HttpCodeError codeError messageDescription
400InvalidInternetChargeType.ValueNotSupportedThe specified InternetChargeType is not valid.The error message returned because the specified InternetChargeType parameter is invalid.
400InvalidInstanceType.ValueUnauthorizedThe specified InstanceType does not exist or beyond the permitted range.The error message returned because the specified instance type does not exist or because you are not authorized to manage instances of the specified instance type.
400InvalidInstanceType.ValueUnauthorizedThe specified InstanceType is not authorized.The error message returned because you are not authorized to use the specified instance type.
400InvalidInstanceType.ValueNotSupportedThe specified InstanceType does not exist or beyond the permitted range.The error message returned because the specified instance type does not exist or because you are not authorized to manage instances of the specified instance type.
400InvalidParameter.MismatchToo many parameters in one request.The error message returned because the number of parameters contained in the request exceeds the upper limit.
400BandwidthUpgradeDenied.EipBoundInstanceThe specified VPC instance has bound EIP, temporary bandwidth upgrade is denied.The error message returned because the instance is associated with an elastic IP address and the instance network bandwidth cannot be temporarily upgraded.
400InvalidTemporary.StartTimeThe specifed Temporary.StartTime is not valid.The error message because the specified Temporary.StartTime parameter is invalid.
400InvalidTemporary.EndTimeThe specifed Temporary.EndTime is not valid.The error message because the specified Temporary.EndTime parameter is invalid.
400Downgrade.NotSupportedDowngrade operation is not supported.The error message returned because the downgrade operation is not supported.
400DependencyViolation.InstanceTypeThe current InstanceType cannot be changed to the specified InstanceType.The error message returned because the current instance type cannot be changed to the specified instance type.
400Account.ArrearageYour account has an outstanding payment.The error message returned because you have unpaid orders in your account.
400InvalidParameter.BandwidthThe specified parameter Bandwidth is not valid.The error message returned because the specified bandwidth is invalid.
400InvalidParameter.ConflictThe specified image does not support the specified instance type.The error message returned because the specified image cannot be used for the specified instance type.
400InvalidParameter.AllowMigrateAcrossZoneThe specified parameter CanMigrateAcrossZone is not valid.The specified AllowMigrateAcrossZone parameter is invalid.
400InvalidParam.SystemDiskCategoryThe specified param SystemDisk.Category is not valid.The error message returned because the specified SystemDisk.Category parameter is invalid.
400ThrottlingRequest was denied due to request throttling, please try again after 5 minutes.The error message returned because your request is throttled. Try again 5 minutes later.
400InvalidInstanceStatus.NotStoppedThe specified Instance status is not stopped.The error message returned because the specified instance is not in the Stopped state.
400InvalidActionSpecified action is not valid.The error message returned because the operation is invalid.
400IdempotenceParamNotMatchThere is a idempotence signature mismatch between this and last request.The error message returned because this request and the previous request contain the same client token but different other parameters.
400InvalidClientToken.ValueNotSupportedThe ClientToken provided is invalid.The error message returned because the specified ClientToken parameter is invalid.
400Price.PricePlanResultNotFoundThe internetMaxBandwidthIn or internetMaxBandwidthOut provided is invalid.The error message returned because the specified InternetMaxBandwidthIn or InternetMaxBandwidthOut parameter is invalid.
400InvalidAction.NotSupportThe ecs on dedicatedHost not support modify instanceType.The error message returned because you cannot change the instance types of instances hosted on dedicated hosts.
400InvalidMarketImageStatus.NotSupportedThe status of specified market image does not support this operation.The error message returned because the operation is not supported while the specified Alibaba Cloud Marketplace image is in the current state.
400InvalidOperation.VpcHasEnabledAdvancedNetworkFeatureThe specified vpc has enabled advanced network feature.The error message returned because advanced features are enabled for the specified VPC. You cannot create low-specification instances in the VPC.
400Invalid.PrivatePoolOptions.MatchCriteriaTarget mode does not support this operation.The error message returned because the operation is not supported while the PrivatePoolOptions.MatchCriteria parameter is set to Target.
400InvalidDiskCategory.NotSupportedThe upgrade operation of instance does not support this category of disk.The error message returned because the upgrade operations of instances do not support the specified disk category.
403CategoryViolationThe specified instance does not support this operation because of its disk category.The error message returned because the configurations of instances that have local disks attached cannot be changed.
403InvalidStatus.ValueNotSupportedThe current status of the resource does not support this operation.The error message returned because the operation is not supported while the resource is in the current state.
403InstanceLockedForSecurityThe specified operation is denied as your instance is locked for security reasons.The error message returned because the operation is not supported while the instance is locked for security reasons.
403InvalidAccountStatus.NotEnoughBalanceYour account does not have enough balance.The error message returned because your account balance is insufficient. Add funds to your account and try again.
403ChargeTypeViolationThe operation is not permitted due to charge type of the instance.The error message returned because the billing method of the instance does not support this operation.
403OperationDeniedThe specified instance is out of usage.The error message returned because the resources of the specified instance type are insufficient.
403LastTokenProcessingThe last token request is processing.The error message returned because the last token request is being processed. Try again later.
403InstanceSpecModification.NotEffectiveThe specified instance has been reserved for making a spec modification and not taken effective in the current contract period.The error message returned because the instance is reserved due to an instance type change. Changes made to it cannot take effect during the current contract period.
403InvalidInstanceType.ValueNotSupportedThe specified zone does not offer the specified instancetype.The error message returned because the specified instance type is unavailable in the specified region.
403ImageNotSupportInstanceTypeThe specified image do not support the InstanceType instance.The error message returned because the specified image does not support the instance type.
403InvalidParameter.NotMatch%sThe error message returned because a specified parameter is invalid. Check whether parameter conflicts exist.
403InvalidInstance.EipNotSupportThe specified instance with eip is not supported, please unassociate eip first.The operation is not supported while an EIP is associated with the instance. Disassociate the EIP first.
403OperationDenied.NoStockThe resource is out of usage.The error message returned because the instance is not in the Running state. Start the instance or check whether the specified operation is invalid.
403OperationDenied.UnpaidOrderThe specified instance has unpaid order.The error message returned because you have unpaid orders for the specified instance. You can log on to the ECS console to pay for the orders.
403OperationDenied%sThe error message returned because the operation is denied.
403InvalidOperation.Ipv4CountExceeded%sThe error message returned because the maximum number of IPv4 addresses has been reached.
403InvalidOperation.Ipv6CountExceeded%sThe error message returned because the maximum number of IPv6 addresses has been reached.
403InvalidOperation.Ipv6NotSupport%sThe error message returned because IPv6 addresses do not support this operation.
403InvalidOperation.InstanceWithEipNotSupportThe special instance with eip not support operate, please unassociate eip first.The error message returned because the operation is not supported while an EIP is associated with this instance. Disassociate the EIP address first.
403SecurityRisk.3DVerificationWe have detected a security risk with your default credit or debit card. Please proceed with verification via the link in your email.The error message returned because risks are detected in your default credit card or debit card. Click the URL in the email for verification.
403InvalidInstance.NotFoundSystemDiskThe specified instance has no system disk.The error message returned because the specified instance has no system disk attached. Make sure that the specified instance has a system disk attached. You can call the DescribeInstances operation to query the details of the specified instance.
403InvalidInstanceType.NotSupportDiskCategoryThe instanceType of the specified instance does not support this disk category.The error message returned because the instance type specified by the InstanceType parameter does not support the disk category of the instance. Try another instance type. For information about the disk categories supported by instance types, see the instance family documentation.
403QuotaExceed.ElasticQuotaNo additional quota is available for the specified ECS instance type.The error message returned because the maximum number of instances of the specified instance type in the region has been reached. Try another region or instance type, or reduce the purchase quantity. You can go to the ECS console or Quota Center to request a quota increase.
403QuotaExceed.ElasticQuotaThe number of the specified ECS instances has exceeded the quota of the specified instance type.The error message returned because the maximum number of instances of the specified instance type in the region has been reached. Try another region or instance type, or reduce the purchase quantity. You can go to the ECS console or Quota Center to request a quota increase.
403QuotaExceed.ElasticQuotaThe number of vCPUs assigned to the ECS instances has exceeded the quota in the zone.The error message returned because the maximum number of vCPUs for all instance types has been reached in the zone. You can go to the ECS console or Quota Center to request a quota increase.
403QuotaExceed.ElasticQuotaThe number of the specified ECS instances has exceeded the quota of the specified instance type, or the number of vCPUs assigned to the ECS instances has exceeded the quota in the zone.The error message returned because the maximum number of instances of the specified instance type in the region has been reached or because the maximum number of vCPUs for all instance types has been reached. You can go to the ECS console or Quota Center to request a quota increase.
403InvalidOperation.InstanceTypeNotSupportEniTrunking%sThe error message returned because the operation is not supported. For more information, see the returned value of the %s in the error message.
403InvalidOperation.MaxEniQueueNumberExceeded%sThe error message returned because the maximum number of queues per ENI has been reached. For more information, see the returned value of the %s in the error message.
403InvalidOperation.ExceedInstanceTypeQueueNumber%sThe error message returned because the maximum number of queues for all ENIs on an instance has been reached. For more information, see the returned value of the %s in the error message.
403InvalidParameter.InvalidEniQueueNumber%sThe error message returned because the specified NetworkInterfaceQueueNumber parameter is invalid. For more information, see the returned value of the %s in the error message.
404InvalidInstanceId.NotFoundThe specified InstanceId does not exist.The error message returned because the specified InstanceId parameter is invalid.
404MissingTemporary.StartTimeTemporary.StartTime is not specified.The error message returned because the Temporary.StartTime parameter is not specified.
404MissingTemporary.EndTimeTemporary.EndTime is not specified.The error message returned because the Temporary.EndTime parameter is not specified.
404InvalidInstanceChargeType.NotFoundThe InstanceChargeType does not exist in our records.The error message returned because the specified instance billing method does not exist.
500InternalErrorThe request processing has failed due to some unknown error, exception or failure.The error message returned because an internal error has occurred. Try again later.
500InternalErrorThe request processing has failed due to some unknown error.The error message returned because an internal error has occurred. Try again later.

For a list of error codes, see Service error codes.