Modifies the billing method for up to 16 disks that are attached to an instance.

Description

When calling this operation, consider the following:

  • Changing the billing method from Subscription to Pay-As-You-Go is suitable for subscribed disks that are attached to a subscribed instance.
  • Changing the billing method from Pay-As-You-Go to Subscription is suitable for Pay-As-You-Go data disks that are attached to a subscribed or Pay-As-You-Go instance.
  • This instance cannot be suspended and have overdue payment.
  • Billing method that was successfully modified cannot be changed again within 5 minutes.
  • By default, the system uses the latest billing method to automatically charge fees. Make sure that your account balance is sufficient. If your account has insufficient funds, the system regards your order as an exception, and you have to cancel this order. If your account balance is insufficient, set AutoPay to false. The system then generates a normal unpaid order for the outstanding payment. You can log on to the ECS console to pay for this order.

Request parameters

Name Type Required Description
Action String Yes The operation that you want to perform. Value: ModifyDiskChargeType.
DiskIds String Yes The list of disk identifiers. This is a JSON formatted array [“d-xxxxxxxxx”, “d-yyyyyyyyy”, … “d-zzzzzzzzz”], including up to 16 identifiers. These identifiers are separated with commas (,).
InstanceId String Yes The identifier of an instance that disks are attached to.
RegionId String Yes The region identifier of an instance. You can call DescribeRegions to view the list of latest regions of Alibaba Cloud.
DiskChargeType String No The billing method for disks. Optional values:
  • PrePaid: Changes the billing method from Pay-As-You-Go to Subscription.
  • PostPaid: Changes the billing method from Subscription to Pay-As-You-Go.
Default value: PrePaid.
DryRun Boolean No Whether the system performs a dry run only. When DryRun is true, the system performs a dry run only, but does not change the actual billing method. Optional values:
  • true
  • false
Default value: false.
AutoPay Boolean No Whether automatic payment is enabled. Optional values:
  • true: Automatic payment is enabled. Make sure that you maintain a sufficient balance in the linked credit card or PayPal account to complete the payment. Otherwise, ECS regards your order as an exception, and you have to cancel this order.
  • false: Generates the order, but does not charge fees. If your PayPal balance is insufficient or the linked credit card reaches the credit limit, the system generates a normal unpaid order for the outstanding payment. You can log on to the ECS console to complete the payment.
Default value: true.
ClientToken String No Guarantees the idempotence of the request. The value is generated by a client and must be unique. It can contain a maximum of 64 ASCII characters. For more information, see How to ensure idempotence.

Response parameters

Name Type Description
OrderId Long The generated order identifier.

Examples

Request example
https://ecs.aliyuncs.com/?Action=ModifyDiskChargeType
&RegionId=cn-hangzhou
&DiskIds=["d-xxxxx1","d-xxxxx2"]
&InstanceId=i-xxxxx1
&AutoPay=false
&ClientToken=xxxxxxxxxxxxxx
&<Common Request Parameters> 
Response example

XML format

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

Error codes

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

Error code Error message HTTP status code Description
Account.Arrearage Your account has an outstanding payment. 400 Your account has an outstanding payment.
IdempotenceParamNotMatch Request uses a client token in a previous request but is not identical to that request. 400 The parameters of the requests that use the same ClientToken do not match.
InvalidClientToken.ValueNotSupported The ClientToken provided is invalid. 400 The ClientToken value is invalid. It should be ASCII characters only.
InvalidInstance.UnpaidOrder The specified instance has unpaid order. 400 The specified instance has an unpaid order.
InvalidInstanceId.Released The specified instance has been released. 400 The specified instance has been released.
OrderCreationFailed Order creation failed, please check your params and try it again later. 400 Order creation has failed.
Throttling You have made too many requests within a short time; your request is denied due to request throttling. 400 You've made too many attempts. Please try again later.
ChargeTypeViolation The operation is not permitted due to charge type of the instance. 403 The billing method of the specified instance does not support this operation.
InvalidAccountStatus.NotEnoughBalance Your account does not have enough balance. 403 The account balance is insufficient.
InvalidPayMethod The specified billing method is invalid. 403 The specified billing method does not exist.
InvalidUser.PassRoleForbidden The RAM user does not have privilege to pass a role. 403 Your RAM user does not have the PassRole permission. Contact the owner of the primary account to grant the PassRole permission.
InvalidDiskIds.NotFound Some of the specified data disks do not exist. 404 The disk identifier does not exist.
InvalidDiskIds.NotPortable The specified DiskId is not portable. 404 The specified undetachable disk does not support changing the billing method.
InvalidRegionId.NotFound The RegionId provided does not exist. 404 The specified RegionId does not exist.
PaymentMethodNotFound No billing method has been registered on the account. 404 You have not selected any billing method.
InternalError The request processing has failed due to some unknown error, exception or failure. 500 Internal error.