All Products
Search
Document Center

Elastic Compute Service:ModifyInstanceSpec

Last Updated:Jun 26, 2026

Modifies the instance type or public bandwidth of a pay-as-you-go ECS instance.

Operation description

Before you use this operation, make sure that you fully understand the billing methods and pricing of ECS...

.

Before you use this operation, make sure that you fully understand the billing methods and pricing of ECS...

Before you change the instance type of a pay-as-you-go instance, you can call DescribeResourcesModification to query the instance types to which the current instance can be changed.

Before you begin.

  • Your account must not have overdue payments.

  • Each call can modify only one configuration at a time. You can modify only the instance type or adjust only the public bandwidth in a single request.

  • The instance status must be Running (Running) or Stopped (Stopped) before you can adjust the public bandwidth. The change takes effect immediately.

  • The instance status must be Stopped (Stopped) before you can modify the instance type. After the modification, you must start the instance for the change to take effect.

Note

In a single region, the total peak pay-by-bandwidth public bandwidth for a single Alibaba Cloud account is limited. For more information, see Public bandwidth limits.

Try it now

Try this API in OpenAPI Explorer, no manual signing needed. Successful calls auto-generate SDK code matching your parameters. Download it with built-in credential security for local usage.

Test

RAM authorization

The table below describes the authorization required to call this API. You can define it in a Resource Access Management (RAM) policy. The table's columns are detailed below:

  • Action: The actions can be used in the Action element of RAM permission policy statements to grant permissions to perform the operation.

  • API: The API that you can call to perform the action.

  • Access level: The predefined level of access granted for each API. Valid values: create, list, get, update, and delete.

  • Resource type: The type of the resource that supports authorization to perform the action. It indicates if the action supports resource-level permission. The specified resource must be compatible with the action. Otherwise, the policy will be ineffective.

    • For APIs with resource-level permissions, required resource types are marked with an asterisk (*). Specify the corresponding Alibaba Cloud Resource Name (ARN) in the Resource element of the policy.

    • For APIs without resource-level permissions, it is shown as All Resources. Use an asterisk (*) in the Resource element of the policy.

  • Condition key: The condition keys defined by the service. The key allows for granular control, applying to either actions alone or actions associated with specific resources. In addition to service-specific condition keys, Alibaba Cloud provides a set of common condition keys applicable across all RAM-supported services.

  • Dependent action: The dependent actions required to run the action. To complete the action, the RAM user or the RAM role must have the permissions to perform all dependent actions.

Action

Access level

Resource type

Condition key

Dependent action

ecs:ModifyInstanceSpec

update

*Instance

acs:ecs:{#regionId}:{#accountId}:instance/{#instanceId}

  • ecs:AssociatePublicIpAddress
None

Request parameters

Parameter

Type

Required

Description

Example

InstanceId

string

Yes

The instance ID.

i-bp67acfmxazb4p****

InstanceType

string

No

The target instance type. For more information, see Instance families. You can also invoke DescribeInstanceTypes to query the most recent instance type list.

ecs.g6.large

InternetMaxBandwidthOut

integer

No

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

Note

In pay-by-traffic mode, the peak inbound and outbound bandwidths are upper limits and are not guaranteed. When resource contention occurs, the peak bandwidths may be throttled. If your workloads require guaranteed bandwidth, use the pay-by-bandwidth mode.

10

InternetMaxBandwidthIn

integer

No

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

  • If the purchased outbound public bandwidth is less than or equal to 10 Mbit/s: 1 to 10. Default value: 10.

  • If the purchased outbound public bandwidth is greater than 10 Mbit/s: 1 to the value of InternetMaxBandwidthOut. Default value: the value of InternetMaxBandwidthOut.

Note

In pay-by-traffic mode, the peak inbound and outbound bandwidths are upper limits and are not guaranteed. When resource contention occurs, the peak bandwidths may be throttled. If your workloads require guaranteed bandwidth, use the pay-by-bandwidth mode.

10

Temporary.StartTime

string

No

Note

This parameter is in invitational preview and is not publicly available.

null

Temporary.EndTime

string

No

Note

This parameter is in invitational preview and is not publicly available.

null

Temporary.InternetMaxBandwidthOut

integer

No

Note

This parameter is in invitational preview and is not publicly available.

null

Async

boolean

No

Specifies whether to submit an asynchronous request. Valid values:

  • true: The request is submitted asynchronously.

  • false: The request is not submitted asynchronously.

Default value: false.

false

AllowMigrateAcrossZone

boolean

No

Specifies whether cross-cluster upgrade of instance types is supported.

  • true: supported.

  • false: not supported.

Default value: false.

If you set the AllowMigrateAcrossZone parameter to true and upgrade the Elastic Compute Service instance based on the response, note the following:

Classic network type instances:

  • For retired instance types, when a non-I/O optimized instance is changed to an I/O optimized instance, the private IP address, disk device names, and software authorization codes of the instance change. For Linux instances, basic disks (cloud) are identified as xvda or xvdb, and ultra disks (cloud_efficiency) and standard SSDs (cloud_ssd) are identified as vda or vdb.

  • For instance families that are available for purchase, the private IP address of the instance changes.

VPC-type instances: For retired instance types, when a non-I/O optimized instance is changed to an I/O optimized instance, the disk device names and software authorization codes of the instance change. For Linux instances, basic disks (cloud) are identified as xvda or xvdb, and ultra disks (cloud_efficiency) and standard SSDs (cloud_ssd) are identified as vda or vdb.

false

SystemDisk.Category

string

No

The new system disk category. Valid values:

  • cloud_efficiency: ultra disk

  • cloud_ssd: standard SSD

Note

This parameter is valid only when you upgrade from a retired instance type to an instance family that is available for purchase and change a non-I/O optimized instance to an I/O optimized instance.

cloud_ssd

ClientToken

string

No

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

0c593ea1-3bea-11e9-b96b-88e9fe637760

ModifyMode

string

No

Note

This parameter is not publicly available.

null

Disk

array<object>

No

Note

This parameter is not publicly available.

object

No

Note

This parameter is not publicly available.

DiskId

string

No

Note

This parameter is not publicly available.

null

Category

string

No

Note

This parameter is not publicly available.

null

PerformanceLevel

string

No

Note

This parameter is not publicly available.

null

DryRun

boolean

No

Specifies whether to perform only a dry run. Valid values:

  • true: performs only a dry run. The instance type and public bandwidth are not modified. The system checks whether the required parameters are specified, whether the request format is valid, whether business restrictions are met, and whether ECS resources are sufficient. If the check fails, the corresponding error is returned. If the check succeeds, the DryRunOperation error code is returned.

  • false (default): performs a dry run and sends the request. If the check succeeds, the instance type and public bandwidth are modified.

false

Response elements

Element

Type

Description

Example

object

RequestId

string

The request ID.

473469C7-AA6F-4DC5-B3DB-A3DC0DE3C83E

Examples

Success response

JSON format

{
  "RequestId": "473469C7-AA6F-4DC5-B3DB-A3DC0DE3C83E"
}

Error codes

HTTP status code

Error code

Error message

Description

400 InvalidInternetChargeType.ValueNotSupported The specified InternetChargeType is not valid. The specified InternetChargeType parameter is invalid.
400 InvalidInstanceType.ValueUnauthorized The specified InstanceType does not exist or beyond the permitted range. The specified instance type does not exist or you are not authorized to manage instances of this instance type.
400 InvalidInstanceType.ValueNotSupported The specified InstanceType does not exist or beyond the permitted range. The specified instance type does not exist or you are not authorized to manage instances of this instance type.
400 InvalidParameter The specified parameter "InternetMaxBandwidthOut" is not valid.
400 InvalidParameter.Mismatch Too many parameters in one request. The number of parameters contained in the request exceeds the upper limit.
400 BandwidthUpgradeDenied.EipBoundInstance The specified VPC instance has bound EIP, temporary bandwidth upgrade is denied. The instance is associated with an EIP and cannot have its bandwidth temporarily upgraded.
400 InvalidTemporary.StartTime The specifed Temporary.StartTime is not valid. The specified start time of the temporary upgrade period is invalid.
400 InvalidTemporary.EndTime The specifed Temporary.EndTime is not valid. The specified end time of the temporary upgrade period is invalid.
400 Downgrade.NotSupported Downgrade operation is not supported. Configuration downgrades are not supported.
400 DependencyViolation.InstanceType The current InstanceType cannot be changed to the specified InstanceType.
400 Account.Arrearage Your account has an outstanding payment. Your account has overdue payments.
400 InvalidParameter.Bandwidth The specified parameter Bandwidth is not valid. The specified bandwidth value is invalid.
400 InvalidParameter.Conflict The specified image does not support the specified instance type. The specified image cannot be used for instances of the specified instance type.
400 InvalidParameter.AllowMigrateAcrossZone The specified parameter CanMigrateAcrossZone is not valid. The specified AllowMigrateAcrossZone parameter is invalid.
400 InvalidParam.SystemDiskCategory The specified param SystemDisk.Category is not valid. The specified system disk category is invalid.
400 Throttling Request was denied due to request throttling, please try again after 5 minutes.
400 InvalidInstanceStatus.NotStopped The specified Instance status is not stopped. The specified instance is not in the Stopped state.
400 InvalidAction Specified action is not valid. The operation is invalid.
400 IdempotenceParamNotMatch There is a idempotence signature mismatch between this and last request. This request and the previous request contain the same client token but different other parameters.
400 InvalidClientToken.ValueNotSupported The ClientToken provided is invalid. The specified ClientToken parameter is invalid.
400 Price.PricePlanResultNotFound The internetMaxBandwidthIn or internetMaxBandwidthOut provided is invalid. The specified InternetMaxBandwidthIn or InternetMaxBandwidthOut parameter is invalid.
400 InvalidAction.NotSupport The ecs on dedicatedHost not support modify instanceType. Instance types cannot be changed for instances hosted on dedicated hosts.
400 InvalidMarketImageStatus.NotSupported The status of specified market image does not support this operation. The Alibaba Cloud Marketplace image is in a state that does not support the current operation.
400 InvalidOperation.VpcHasEnabledAdvancedNetworkFeature The specified vpc has enabled advanced network feature. Advanced features are enabled for the specified VPC. You cannot create low-specification instances in the VPC.
400 Invalid.PrivatePoolOptions.MatchCriteria Target mode does not support this operation. The operation is not supported while the PrivatePoolOptions.MatchCriteria parameter is set to Target.
400 InstanceTypeNotSupported.TooManyDisksAttached %s
400 InvalidDiskCategory.NotSupported The upgrade operation of instance does not support this category of disk.
400 InvalidParameter.CloudboxNotSupported %s
400 QuotaExceed.DiskCapacity The used capacity of disk type has exceeded the quota in the zone, %s. The capacity of disks that belong to the specified disk category exceeds the quota limit for the zone.
400 InvalidParam.Async The specified parameter async is not valid.
400 MissingParameter.DiskCategory The specified parameter Disk.Category can not be null when Disk.DiskId is specified.
400 InvalidParameter.DiskCategory The specified parameter Disk.Category is not valid.
400 InvalidPerformanceLevel.Malformed The specified parameter Disk.n.PerformanceLevel is not valid.
400 NoPermission.Price The operation requires price permission. Please either apply for permission from your main account, or set the parameter AutoPay as true. This operation requires price permission. Please apply for permission to your master account, or set the parameter AutoPay to true for automatic payment.
400 InvalidParameter.DedicatedRegionNotSupported The specified action is rejected because the specified ECS instance in the dedicated region does not support public IP. Parameter error codes not supported in the dedicated region
400 InvalidOperation.OnlineModificationUnsupported Online modification of instance type is not supported for the specified instance due to its CPU topology.
400 QuotaExceeded.InternetBandwidth %s. Under your current account, the public network bandwidth of the Pay-As-You-Go ECS instance charged by fixed bandwidth exceeds the total bandwidth quota limit.
400 InvalidOperation.InstanceTypeNotSupportRss The ECS instance type does not support Rss. The ECS instance type does not support Rss.
400 InvalidInstanceType.NotSupportCpuOptionsNestedVirtualization The specified instance type does not support CpuOptions.NestedVirtualization: %s. The specified instance type does not support CpuOptions.NestedVirtualization value.
401 InvalidInstanceType.ValueUnauthorized The specified InstanceType is not authorized. You are not authorized to use the specified instance type.
500 InternalError The request processing has failed due to some unknown error, exception or failure. An internal error has occurred. Try again later.
403 CategoryViolation The specified instance does not support this operation because of its disk category.
403 InvalidStatus.ValueNotSupported The current status of the resource does not support this operation. The resource is in a state that does not support the current operation.
403 InstanceLockedForSecurity The specified operation is denied as your instance is locked for security reasons.
403 InvalidAccountStatus.NotEnoughBalance Your account does not have enough balance.
403 ChargeTypeViolation The operation is not permitted due to charge type of the instance.
403 OperationDenied The specified instance is out of usage. The resources of the specified instance type are insufficient.
403 LastTokenProcessing The last token request is processing.
403 InvalidInstance.UnpaidOrder The specified instance has unpaid order.
403 InstanceSpecModification.NotEffective The specified instance has been reserved for making a spec modification and not taken effective in the current contract period. The specified instance is retained due to the instance type change. The instance type change cannot take effect during the current contract period.
403 InvalidInstanceType.ValueNotSupported The specified zone does not offer the specified instancetype. The specified instance type is unavailable in the specified region.
403 ImageNotSupportInstanceType The specified image do not support the InstanceType instance. The specified image does not support the instance type.
403 InstanceType.Offline The specified InstanceType has been offline. The specified InstanceType has been offline.
403 InvalidParameter.NotMatch %s A specified parameter is invalid. Check whether parameter conflicts exist.
403 InvalidInstance.EipNotSupport The 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.
403 InvalidInstance.NatPortMapNotSupport The special instance with nat port map not support operate, please remove nat port map first.
403 InvalidOperation.StarterPackage StarterPackage not support modification.
403 OperationDenied.NoStock The resource is out of usage.
403 OperationDenied.UnpaidOrder The specified instance has unpaid order. Your account has unpaid orders for the specified instance. You can log on to the ECS console to pay for the orders.
403 InvalidOperation.EipNotSupport The special instance with eip not support operate, please unassociate eip first.
403 InvalidParameter.InternetMaxBandwidthOut The specified parameter InternetMaxBandwidthOut is invalid.
403 InvalidOperation.EniCountExceeded %s
403 InvalidOperation.Ipv4CountExceeded %s The operation is valid because the maximum number of IPv4 addresses has been reached.
403 InvalidOperation.Ipv6CountExceeded %s The operation is valid because the maximum number of IPv6 addresses has been reached.
403 InvalidOperation.Ipv6NotSupport %s
403 InvalidOperation.Ipv4NotSupport %s
403 InvalidOperation.InstanceWithEipNotSupport The special instance with eip not support operate, please unassociate eip first. The operation is not supported while an EIP is associated with the instance. Disassociate the EIP first.
403 SecurityRisk.3DVerification We have detected a security risk with your default credit or debit card. Please proceed with verification via the link in your email.
403 InvalidInstance.NotFoundSystemDisk The specified instance has no system disk.
403 InvalidInstanceType.NotSupportDiskCategory The instanceType of the specified instance does not support this disk category. The instance type does not support the current disk category. Try another instance type. For information about the disk categories supported by instance types, see the instance family documentation.
403 QuotaExceed.ElasticQuota No additional quota is available for the specified ECS instance type. The maximum number of instances of the specified instance type in the region has been reached. Reduce the quantity of instances that you want to purchase or try another region or instance type. Alternatively, you can go to the ECS console or Quota Center to request a quota increase.
403 InvalidResourceType.NotSupported %s The specified resource combination does not exist. Change to another zone or specification.
403 InvalidOperation.NotAllowed The specified vpc %s has enabled senior network feature.
403 InvalidOperation.InstanceTypeNotSupportEniTrunking %s
403 InvalidOperation.MaxEniQueueNumberExceeded %s
403 InvalidOperation.ExceedInstanceTypeQueueNumber %s The maximum number of queues for all ENIs on an instance has been exceeded. For more information, see the return value of the %s placeholder in the error message.
403 InvalidParameter.InvalidEniQueueNumber %s
403 HibernationConfigured.InstanceOperationForbidden The operation is not permitted due to limit of the hibernation configured instance. The operation cannot be performed due to the limitations of instances for which the instance hibernation feature is enabled.
403 InvalidOperation.InstanceTypeNotSupportHighPerformanceTrafficMode %s The instance type of the specified instance does not support the NIC of the RDMA communication mode.
403 InvalidOperation.EniQueuePairNumberOverflow %s
403 InvalidOperation.HighPerformanceEniPerInstanceLimitExceeded %s
403 InvalidOperation.MaxEniQueuePairNumberExceed %s
403 InvalidOperation.MaxModifyOnlineNumberExceeded The specified instance has reached the maximum number of modify online attempts and needs to be rebooted.
403 InvalidOperation.RebootingRequired The specified instance needs to be rebooted.
403 InvalidOperation.OSTypeNotSupported The specified OS type is not supported.
403 InvalidSystemDiskCategory.ValueNotSupported The specified parameter SystemDisk.Category is not valid. The specified SystemDisk.Category value is not supported.
403 InvalidDataDiskCategory.ValueNotSupported The specified Category of Data Disk is not valid. The specified data disk type is not supported.
403 InvalidDiskCategory.NotSupported The upgrade operation of instance does not support this category of disk.
404 InvalidInstanceId.NotFound The specified InstanceId does not exist. The specified instanceId is invalid.
404 MissingTemporary.StartTime Temporary.StartTime is not specified. The start time of the temporary upgrade period must be specified.
404 MissingTemporary.EndTime Temporary.EndTime is not specified. The end time of the temporary upgrade period must be specified.
404 InvalidInstanceChargeType.NotFound The InstanceChargeType does not exist in our records.
503 LimitedOperation.ServiceUnavailable The service is currently unavailable. Please try again later. The service is currently unavailable. Please try again later.

See Error Codes for a complete list.

Release notes

See Release Notes for a complete list.