You can call this operation to modify the bandwidth configurations of an instance. You can modify the network specifications of an instance to improve network performance if necessary.

Description

When you call this operation, note that:

  • When modifying the bandwidth configurations of a subscription (PrePaid) instance, you can perform the following operations:
    • You can upgrade or downgrade the bandwidth billed in the pay-by-data-transfer (PayByTraffic) method. You can only upgrade the bandwidth billed in the pay-by-bandwidth (PayByBandwidth) method.
    • When the outbound public bandwidth is upgraded from 0 Mbit/s, a public IP address is automatically allocated.
    • You can use the ModifyInstanceNetworkSpec operation to change the network billing method from pay-by-data-transfer (PayByTraffic) to pay-by-bandwidth (PayByBandwidth). To change the network billing method from pay-by-bandwidth (PayByBandwidth) to pay-by-data-transfer (PayByTraffic), you can use only the ECS console.
  • When modifying the bandwidth configurations of a pay-as-you-go instance, you can perform the following operations:
    • You can upgrade or downgrade the bandwidth.
    • When the outbound public bandwidth is upgraded from 0 Mbit/s, no public IP address is automatically allocated. You must call the AllocatePublicIpAddress operation to allocate a public IP address to the instance.
    • You can change the bandwidth billing method from pay-by-data-transfer (PayByTraffic) to pay-by-bandwidth (PayByBandwidth).
    • You can change the bandwidth billing method from pay-by-bandwidth (PayByBandwidth) to pay-by-data-transfer (PayByTraffic).
  • For an instance in a classic network, when the outbound public bandwidth (InternetMaxBandwidthOut) is upgraded from 0 Mbit/s, the instance must already be in the Stopped state.
  • After the bandwidth is upgraded, AutoPay is set to true by default. Make sure that your account has sufficient balance. Otherwise, your order becomes invalid and you have to cancel this order. If your account balance is insufficient, you can set the AutoPay parameter to false to generate a normal order. Then, you can log on to the ECS console to pay for the order.
  • You can downgrade the public bandwidth of each subscription instance for a maximum of three times. A maximum of three refunds for price difference can be made.
  • The price difference will be refunded to the payment account you used. Used coupons cannot be refunded.
  • Each time the modification of bandwidth configuration succeeds, you cannot modify the bandwidth of that instance within five minutes.

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

Parameter Type Required Example Description
InstanceId String Yes i-bp67acfmxazb4ph***

The ID of the instance for which you want to modify network configurations.

Action String No ModifyInstanceNetworkSpec

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

InternetMaxBandwidthIn Integer No 10

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

InternetMaxBandwidthOut Integer No 10

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

NetworkChargeType String No PayByTraffic

The billing method for network usage. Valid values:

  • PayByBandwidth: pay-by-bandwidth
  • PayByTraffic: pay-by-data-transfer.
StartTime String No 2017-12-05T22:40Z

The start time of the temporary bandwidth upgrade. Specify the time in the ISO 8601 standard in the yyyy-MM-ddThh:mmZ format. The time must be in UTC and be accurate to minute (mm).

EndTime String No 2017-12-06T22Z

The end time of the temporary bandwidth upgrade. Specify the time in the ISO 8601 standard in the yyyy-MM-ddThhZ format. The time must be in UTC and be accurate to hour (hh).

AllocatePublicIp Boolean No false

Specifies whether to allocate a public IP address.

Default value: false

AutoPay Boolean No true

Specifies whether payment is automatically made. Valid values:

  • true: After the bandwidth is upgraded, the payment is automatically made. Make sure that your account has sufficient balance when you set the value of the Autopay parameter to true. If your account has no sufficient balance, your order cannot be paid in the ECS console and becomes invalid. You have to cancel it.
  • false: After the bandwidth is upgraded, an order is generated but it is not paid for. If your account balance is insufficient, you can set the AutoPay parameter to false to generate a normal order. Then, you can log on to the ECS console to pay for the order.

Default value: true

ClientToken String No 123e4567-e89b-12d3-a456-426655440000

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

Response parameters

Parameter Type Example Description
OrderId String 1111111111111111111111110

The ID of the generated order.

RequestId String 473469C7-AA6F-4DC5-B3DB-A3DC0DE3C83E

The ID of the request.

Examples

Sample requests

https://ecs.aliyuncs.com/?Action=ModifyInstanceNetworkSpec
&InstanceId=i-bp67acfmxazb4ph***
&InternetMaxBandwidthOut=10
&ClientToken=xxxxxxxxxxxxxx
&<Common request parameters>

Sample success responses

XML format

<ModifyInstanceNetworkSpecResponse>
        <RequestId>04F0F334-1335-436C-A1D7-6C044FE73368</RequestId>
        <OrderId>1111111111111111111111110</OrderId>
</ModifyInstanceNetworkSpecResponse>

JSON format

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

Error codes

HTTP status code Error code Error message Description
404 InvalidInstanceId.NotFound The specified InstanceId does not exist. The error message returned because the specified InstanceId parameter does not exist.
400 InvalidInternetMaxBandwidthIn.ValueNotSupported The specified InternetMaxBandwidthIn is beyond the permitted range. The error message returned because the specified InternetMaxBandwidthIn parameter is not within the allowed range.
400 InvalidInternetMaxBandwidthOut.ValueNotSupported The specified InternetMaxBandwidthOut is beyond the permitted range. The error message returned because the specified InternetMaxBandwidthOut parameter is not within the allowed range.
403 IncorrectInstanceStatus The current status of the instance does not support this operation. The error message returned because this operation is not supported while the instance is in the current state.
403 InstanceLockedForSecurity The 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.
403 InstanceExpiredOrInArrears The specified operation is denied as your prepay instance is expired (prepay mode) or in arrears (afterpay mode). The error message returned because the subscription instance has expired. Renew the instance and try again.
500 InternalError The request processing has failed due to some unknown error. The error message returned because an internal error has occurred. Try again later. If the problem persists, submit a ticket.
403 ChargeTypeViolation The operation is not permitted due to billing method of the instance. The error message returned because this operation is not supported by the billing method.
403 OperationDenied The operation is denied due to the instance is PrePaid. The error message returned because the billing method of the instance is not supported.
400 OperationDenied Specified instance is in VPC. The error message returned because the specified instance is in a VPC.
400 InvalidParameter.Bandwidth %s The error message returned because the specified bandwidth is invalid.
400 InvalidParameter.Conflict %s The error message returned because the parameter conflicts with another parameter.
400 InvalidStartTime.ValueNotSupported %s The error message returned because the specified start time is not within the allowed range.
400 Account.Arrearage Your account has an outstanding payment. The error message returned because your account has overdue payments.
400 InvalidInternetChargeType.ValueNotSupported The specified InternetChargeType is invalid. The error message returned because the specified billing method for network usage is invalid.
400 DecreasedBandwidthNotAllowed %s The error message returned because the bandwidth is downgraded.
400 BandwidthUpgradeDenied.EipBoundInstance The specified VPC instance has bound EIP, temporary bandwidth upgrade is denied. The error message returned because the instance is bound with an EIP and the instance bandwidth cannot be temporarily upgraded.
400 InvalidClientToken.ValueNotSupported The ClientToken provided is invalid. The error message returned because the specified client token is invalid.
403 InvalidAccountStatus.NotEnoughBalance Your account does not have enough balance. The error message returned because your account balance is insufficient. You must top up your account before proceeding.
403 InvalidInstance.UnPaidOrder The specified Instance has unpaid order. The error message returned because you have outstanding orders for the specified instance. Pay for the orders and try again.
400 Throttling Request was denied due to request throttling, please try again after 5 minutes. The error message returned because the request is denied due to throttling.
400 InvalidAction Specified action is not valid. The error message returned because this operation is invalid.
400 IpAllocationError Allocate public ip failed. The error message returned because the allocation of public IP addresses fails.
400 InvalidParam.AllocatePublicIp The specified param AllocatePublicIp is invalid. The error message returned because the value specified for the AllocatePublicIp parameter is invalid.
400 InstanceDowngrade.QuotaExceed Quota of instance downgrade is exceed. The error message returned because the maximum number of instance type downgrades for the instance has been reached.
400 InvalidBandwidth.ValueNotSupported Instance upgrade bandwidth of temporary not allow less then existed. The error message returned because the target bandwidth for the temporary upgrade is lower than the current bandwidth.
403 InvalidInstance.InstanceNotSupported The special vpc instance with eip not need bandwidth. The error message returned because you specify the bandwidth for the instance that is located within a VPC and is bound with an EIP.
400 InvalidInstanceStatus The specified instance status does not support this action. The error message returned because this operation is not supported when the instance is in the current state.
403 InvalidInstanceStatus The current status of the instance does not support this operation. The error message returned because this operation is not supported when the instance is in the current state.
400 InvalidInstance.UnPaidOrder Unpaid order exists in your account, please complete or cancel the payment in the expense center. The error message returned because outstanding orders exist in your account.
400 OperationDenied After downgrade, you cannot upgrade or downgrade your instances again in the remaining time of the current billing cycle. The error message returned because you cannot upgrade or downgrade your instances in the remaining time of the current billing cycle after downgrade.
400 InvalidInternetChargeType.ValueNotSupported %s The error message returned because the specified billing method for network usage is not supported.
400 LastOrderProcessing The previous order is still processing, please try again later. The error message returned because the order is being processed. Try again later.
400 OperationDenied The current user does not support this operation. The error message returned because you are not authorized to perform this operation.
403 NAT_PUBLIC_IP_BINDING_FAILED Binding nat public ip failed The error message returned because you fail to bind a public IP address to an instance.
403 InvalidInstance.EipNotSupport The specified instance with eip is not supported, please unassociate eip first. The error message returned because the operation is not supported while an EIP has been bound to this instance. Unbind the EIP first.
403 InvalidNetworkType.ValueNotSupported The specified parameter NetworkType is not valid. The error message returned because the specified network type is invalid.
500 InternalError The request processing has failed due to some unknown error, exception or failure. The error message returned because an unknown error has occurred.

For a list of error codes, visit the API Error Center.