All Products
Search
Document Center

Elastic Compute Service:ModifyInstanceSpec

Last Updated:Nov 18, 2024

Changes the instance type and public bandwidth of a pay-as-you-go Elastic Compute Service (ECS) instance.

Operation description

Usage notes

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

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 (Running) or Stopped (Stopped) state.

  • Before you change the instance type of a pay-as-you-go instance, call the DescribeResourcesModification operation to query compatible instance types.

  • You can change the instance type of an instance only when the instance is in the Stopped (Stopped) state.

  • The instance type and the public bandwidth of an instance cannot be changed together.

  • Starting November 27, 2020, the maximum bandwidth value that is available for you to create ECS instances or change ECS instance configurations is subject to the throttling policy of your account. To increase the maximum bandwidth value, submit a ticket. The following throttling policies apply:

    • In each region, the sum of actual maximum bandwidths of all ECS instances that use the pay-by-traffic billing method for network usage cannot exceed 5 Gbit/s.
    • In each region, the sum of actual maximum bandwidths of all ECS instances that use the pay-by-bandwidth billing method for network usage cannot exceed 50 Gbit/s.

Debugging

You can run this interface directly in OpenAPI Explorer, saving you the trouble of calculating signatures. After running successfully, OpenAPI Explorer can automatically generate SDK code samples.

Authorization information

The following table shows the authorization information corresponding to the API. The authorization information can be used in the Action policy element to grant a RAM user or RAM role the permissions to call this API operation. Description:

  • Operation: the value that you can use in the Action element to specify the operation on a resource.
  • Access level: the access level of each operation. The levels are read, write, and list.
  • Resource type: the type of the resource on which you can authorize the RAM user or the RAM role to perform the operation. Take note of the following items:
    • The required resource types are displayed in bold characters.
    • If the permissions cannot be granted at the resource level, All Resources is used in the Resource type column of the operation.
  • Condition Key: the condition key that is defined by the cloud service.
  • Associated operation: other operations that the RAM user or the RAM role must have permissions to perform to complete the operation. To complete the operation, the RAM user or the RAM role must have the permissions to perform the associated operations.
OperationAccess levelResource typeCondition keyAssociated operation
ecs:ModifyInstanceSpecupdate
*Instance
acs:ecs:{#regionId}:{#accountId}:instance/{#instanceId}
    none
none

Request parameters

ParameterTypeRequiredDescriptionExample
InstanceIdstringYes

The ID of the instance.

i-bp67acfmxazb4p****
InstanceTypestringNo

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

ecs.g6.large
InternetMaxBandwidthOutintegerNo

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

Note When the pay-by-traffic billing method for network usage is used, the maximum inbound and outbound bandwidths are used as the upper limits of bandwidths instead of guaranteed performance specifications. In scenarios where demand outstrips resource supplies, these maximum bandwidth values may not be reached. If you want guaranteed bandwidths for your instance, use the pay-by-bandwidth billing method for network usage.
10
InternetMaxBandwidthInintegerNo

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 value of this parameter ranges from 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 billing method for network usage is used, the maximum inbound and outbound bandwidths are used as the upper limits of bandwidths instead of guaranteed performance specifications. In scenarios where demand outstrips resource supplies, these maximum bandwidth values may not be reached. If you want guaranteed bandwidths for your instance, use the pay-by-bandwidth billing method for network usage.
10
Temporary.StartTimestringNo
Note This parameter is in invitational preview and is not publicly available.
hide
Temporary.EndTimestringNo
Note This parameter is in invitational preview and is not publicly available.
hide
Temporary.InternetMaxBandwidthOutintegerNo
Note This parameter is in invitational preview and is not publicly available.
0
AsyncbooleanNo

Specifies whether to submit an asynchronous request. Valid values:

  • true
  • false

Default value: false.

false
AllowMigrateAcrossZonebooleanNo

Specifies whether to allow cross-cluster instance type upgrade.

  • true
  • false

Default value: false.

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

Instance that resides in the classic network:

  • 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 authorization codes of the instance change. For a Linux instance, basic disks (cloud) are identified as xvd* such as xvda and xvdb, and ultra disks (cloud_efficiency) and standard SSDs (cloud_ssd) are identified as vd* such as vda and vdb.
  • For instance families available for purchase, when the instance type of an instance is changed, the private IP address of the instance changes.

Instance that resides in a virtual private cloud (VPC): 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 a Linux instance, basic disks (cloud) are identified as xvd* such as xvda and xvdb, and ultra disks (cloud_efficiency) and standard SSDs (cloud_ssd) are identified as vd* such as vda and vdb.

false
SystemDisk.CategorystringNo

The new category of the system disk. Valid values:

  • cloud_efficiency: ultra disk
  • cloud_ssd: standard SSD
Note This parameter takes effect only when you upgrade a non-I/O optimized instance of a retired instance type to an I/O optimized instance of an instance type available for purchase.
cloud_ssd
ClientTokenstringNo

The client token that is used to ensure the idempotence of the request. You can use the client to generate the token, but you must make sure that the token is unique among different requests. The token 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
ModifyModestringNo
Note This parameter is not publicly available.

Valid values:

  • Online
  • Offline
null
DryRunbooleanNo

Specifies whether to perform only a dry run, without performing the actual request. Valid values:

  • true: performs only a dry run. The system checks the request for potential issues, including missing parameter values, incorrect request syntax, service limits, and unavailable ECS resources. If the request fails the dry run, an error message is returned. If the request passes the dry run, the DryRunOperation error code is returned.
  • false (default): performs a dry run and performs the actual request.
false

Response parameters

ParameterTypeDescriptionExample
object
RequestIdstring

The request ID.

473469C7-AA6F-4DC5-B3DB-A3DC0DE3C83E

Examples

Sample success responses

JSONformat

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

Error codes

HTTP status codeError codeError messageDescription
400InvalidInternetChargeType.ValueNotSupportedThe specified InternetChargeType is not valid.The specified InternetChargeType parameter is invalid.
400InvalidInstanceType.ValueUnauthorizedThe 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.
400InvalidInstanceType.ValueUnauthorizedThe specified InstanceType is not authorized.You are not authorized to use the specified instance type.
400InvalidInstanceType.ValueNotSupportedThe 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.
400InvalidParameterThe specified parameter "InternetMaxBandwidthOut" is not valid.-
400InvalidParameter.MismatchToo many parameters in one request.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 instance is associated with an EIP and cannot have its bandwidth temporarily upgraded.
400InvalidTemporary.StartTimeThe specifed Temporary.StartTime is not valid.The specified start time of the temporary upgrade period is invalid.
400InvalidTemporary.EndTimeThe specifed Temporary.EndTime is not valid.The specified end time of the temporary upgrade period is invalid.
400Downgrade.NotSupportedDowngrade operation is not supported.Configuration downgrades are not supported.
400DependencyViolation.InstanceTypeThe current InstanceType cannot be changed to the specified InstanceType.-
400Account.ArrearageYour account has an outstanding payment.Your account has overdue payments.
400InvalidParameter.BandwidthThe specified parameter Bandwidth is not valid.The specified bandwidth value is invalid.
400InvalidParameter.ConflictThe specified image does not support the specified instance type.The specified image cannot be used for instances of 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 specified system disk category is invalid.
400ThrottlingRequest was denied due to request throttling, please try again after 5 minutes.-
400InvalidInstanceStatus.NotStoppedThe specified Instance status is not stopped.The specified instance is not in the Stopped state.
400InvalidActionSpecified action is not valid.The operation is invalid.
400IdempotenceParamNotMatchThere 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.
400InvalidClientToken.ValueNotSupportedThe ClientToken provided is invalid.The specified ClientToken parameter is invalid.
400Price.PricePlanResultNotFoundThe internetMaxBandwidthIn or internetMaxBandwidthOut provided is invalid.The specified InternetMaxBandwidthIn or InternetMaxBandwidthOut parameter is invalid.
400InvalidAction.NotSupportThe ecs on dedicatedHost not support modify instanceType.Instance types cannot be changed for instances hosted on dedicated hosts.
400InvalidMarketImageStatus.NotSupportedThe 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.
400InvalidOperation.VpcHasEnabledAdvancedNetworkFeatureThe specified vpc has enabled advanced network feature.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 operation is not supported while the PrivatePoolOptions.MatchCriteria parameter is set to Target.
400InstanceTypeNotSupported.TooManyDisksAttached%s-
400InvalidDiskCategory.NotSupportedThe upgrade operation of instance does not support this category of disk.-
400InvalidParameter.CloudboxNotSupported%s-
400QuotaExceed.DiskCapacityThe 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.
400InvalidParam.AsyncThe specified parameter async is not valid.-
400MissingParameter.DiskCategoryThe specified parameter Disk.Category can not be null when Disk.DiskId is specified.-
400InvalidParameter.DiskCategoryThe specified parameter Disk.Category is not valid.-
400InvalidPerformanceLevel.MalformedThe specified parameter Disk.n.PerformanceLevel is not valid.-
400NoPermission.PriceThe operation requires price permission. Please either apply for permission from your main account, or set the parameter AutoPay as true.-
400InvalidParameter.DedicatedRegionNotSupportedThe 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
400InvalidOperation.OnlineModificationUnsupportedOnline modification of instance type is not supported for the specified instance due to its CPU topology.-
400QuotaExceeded.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.
403CategoryViolationThe specified instance does not support this operation because of its disk category.The configurations of instances that have local disks attached cannot be upgraded or downgraded.
403InvalidStatus.ValueNotSupportedThe current status of the resource does not support this operation.The resource is in a state that does not support the current operation.
403InstanceLockedForSecurityThe specified operation is denied as your instance is locked for security reasons.-
403InvalidAccountStatus.NotEnoughBalanceYour account does not have enough balance.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 operation is not supported while the instance is using the current billing method.
403OperationDeniedThe specified instance is out of usage.The resources of the specified instance type are insufficient.
403LastTokenProcessingThe last token request is processing.A token request is being processed. Try again later.
403InvalidInstance.UnpaidOrderThe specified instance has unpaid order.The specified instance has a purchase order not paid for.
403InstanceSpecModification.NotEffectiveThe 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.
403InvalidInstanceType.ValueNotSupportedThe specified zone does not offer the specified instancetype.The specified instance type is unavailable in the specified region.
403ImageNotSupportInstanceTypeThe specified image do not support the InstanceType instance.The specified image does not support the instance type.
403InstanceType.OfflineThe specified InstanceType has been offline.-
403InvalidParameter.NotMatch%sA 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.
403InvalidInstance.NatPortMapNotSupportThe special instance with nat port map not support operate, please remove nat port map first.-
403InvalidOperation.StarterPackageStarterPackage not support modification.-
403OperationDenied.NoStockThe resource is out of usage.The instance is not in the Running state. Start the instance or check whether the specified operation is valid.
403OperationDenied.UnpaidOrderThe 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.
403OperationDenied%sThe operation is denied.
403InvalidOperation.EipNotSupportThe special instance with eip not support operate, please unassociate eip first.-
403InvalidParameter.InternetMaxBandwidthOutThe specified parameter InternetMaxBandwidthOut is invalid.-
403InvalidOperation.EniCountExceeded%s-
403InvalidOperation.Ipv4CountExceeded%sThe operation is valid because the maximum number of IPv4 addresses has been reached.
403InvalidOperation.Ipv6CountExceeded%sThe operation is valid because the maximum number of IPv6 addresses has been reached.
403InvalidOperation.Ipv6NotSupport%s-
403InvalidOperation.Ipv4NotSupport%s-
403InvalidOperation.InstanceWithEipNotSupportThe 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.
403SecurityRisk.3DVerificationWe have detected a security risk with your default credit or debit card. Please proceed with verification via the link in your email.-
403InvalidInstance.NotFoundSystemDiskThe specified instance has no system disk.The specified instance does not have a system disk. Make sure that the instance has a system disk. You can call the DescribeInstances operation to query the details of the instance.
403InvalidInstanceType.NotSupportDiskCategoryThe 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.
403QuotaExceed.ElasticQuotaNo 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.
403QuotaExceed.ElasticQuotaThe number of the specified ECS instances has exceeded the quota of the specified 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.
403QuotaExceed.ElasticQuotaThe number of vCPUs assigned to the ECS instances has exceeded the quota in the zone.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.
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 maximum number of instances of the specified instance type in the region has been reached, or 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.
403InvalidResourceType.NotSupported%s-
403InvalidOperation.NotAllowedThe specified vpc %s has enabled senior network feature.-
403InvalidOperation.InstanceTypeNotSupportEniTrunking%s-
403InvalidOperation.MaxEniQueueNumberExceeded%s-
403InvalidOperation.ExceedInstanceTypeQueueNumber%sThe 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.
403InvalidParameter.InvalidEniQueueNumber%s-
403HibernationConfigured.InstanceOperationForbiddenThe 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.
403InvalidOperation.InstanceTypeNotSupportHighPerformanceTrafficMode%s-
403InvalidOperation.EniQueuePairNumberOverflow%s-
403InvalidOperation.HighPerformanceEniPerInstanceLimitExceeded%s-
403InvalidOperation.MaxEniQueuePairNumberExceed%s-
403InvalidOperation.MaxModifyOnlineNumberExceededThe specified instance has reached the maximum number of modify online attempts and needs to be rebooted.-
403InvalidOperation.RebootingRequiredThe specified instance needs to be rebooted.-
403InvalidOperation.OSTypeNotSupportedThe specified OS type is not supported.-
403InvalidSystemDiskCategory.ValueNotSupportedThe specified parameter SystemDisk.Category is not valid.The specified SystemDisk.Category value is not supported.
403InvalidDataDiskCategory.ValueNotSupportedThe specified Category of Data Disk is not valid.The specified data disk type is not supported.
404InvalidInstanceId.NotFoundThe specified InstanceId does not exist.The specified instance does not exist.
404MissingTemporary.StartTimeTemporary.StartTime is not specified.The start time of the temporary upgrade period must be specified.
404MissingTemporary.EndTimeTemporary.EndTime is not specified.The end time of the temporary upgrade period must be specified.
404InvalidInstanceChargeType.NotFoundThe InstanceChargeType does not exist in our records.The specified instance billing method does not exist.
500InternalErrorThe request processing has failed due to some unknown error, exception or failure.An internal error has occurred. Try again later.
500InternalErrorThe request processing has failed due to some unknown error.An internal error has occurred. Try again later.

For a list of error codes, visit the Service error codes.

Change history

Change timeSummary of changesOperation
2024-09-27The Error code has changedView Change Details
2024-09-12The Error code has changedView Change Details
2024-02-01The Error code has changed. The request parameters of the API has changedView Change Details
2023-12-14The Error code has changedView Change Details
2023-10-10The Error code has changedView Change Details
2023-08-30The Error code has changedView Change Details
2023-05-08The Error code has changedView Change Details
2023-04-07The Error code has changed. The request parameters of the API has changedView Change Details