Switches the billing method of data disks attached to a subscription ECS instance between pay-as-you-go and subscription.
Operation description
Before you change the billing method of data disks, carefully read Change the billing method of disks.
When you call this operation, note the following items:
You cannot change the billing method of data disks attached to pay-as-you-go instances. Pay-as-you-go instances only support pay-as-you-go disks.
The instance to which the data disk is attached must not be stopped due to expiration.
Refunds for price differences after the billing method is changed are returned to your original payment method. Used vouchers are not refunded.
After the billing method of a disk is changed, you cannot change it again within 5 minutes.
After you change the billing method, automatic deduction is enabled by default. You must ensure that your account balance is sufficient. Otherwise, an abnormal order is generated and can only be canceled. If your account balance is insufficient, you can set the AutoPay parameter to false. In this case, a normal unpaid order is generated. You can log on to the Alibaba Cloud Expenses and Costs console and pay the order on the Order Management page.
Try it now
Test
RAM authorization
|
Action |
Access level |
Resource type |
Condition key |
Dependent action |
|
ecs:ModifyDiskChargeType |
update |
*Instance
|
None | None |
Request parameters
|
Parameter |
Type |
Required |
Description |
Example |
| InstanceId |
string |
Yes |
The ID of the instance to which the disk is attached. |
i-bp1i778bq705cvx1**** |
| RegionId |
string |
Yes |
The region ID of the instance. You can call DescribeRegions to query the most recent region list. |
cn-hangzhou |
| DiskIds |
string |
Yes |
The list of disk IDs. The value is a JSON array. You can specify up to 16 disk IDs. Separate multiple IDs with commas (,). |
["d-bp67acfmxazb4ph****", "d-bp67acfmxazb4pi****", … "d-bp67acfmxazb4pj****"] |
| AutoPay |
boolean |
No |
Specifies whether to enable automatic payment. Valid values:
|
true |
| 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 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 Ensure idempotence. |
123e4567-e89b-12d3-a456-426655440000 |
| DiskChargeType |
string |
No |
The billing method of the disk. Valid values:
Note
When you switch a pay-as-you-go disk to a subscription disk, the billing cycle of the disk capacity is automatically synchronized with that of the associated ECS instance. |
PostPaid |
Response elements
|
Element |
Type |
Description |
Example |
|
object |
|||
| OrderId |
string |
The ID of the generated order. |
123456**** |
| RequestId |
string |
The request ID. |
473469C7-AA6F-4DC5-B3DB-A3DC0DE3C83E |
Examples
Success response
JSON format
{
"OrderId": "123456****",
"RequestId": "473469C7-AA6F-4DC5-B3DB-A3DC0DE3C83E"
}
Error codes
|
HTTP status code |
Error code |
Error message |
Description |
|---|---|---|---|
| 400 | InvalidInstanceType.ValueUnauthorized | The specified InstanceType is not authorized. | |
| 400 | InvalidInstanceType.ValueNotSupported | The specified InstanceType is not supported. | The specified instance type is not supported. Try another instance type. |
| 400 | MissingParameter.RegionId | RegionId should not be null. | The RegionId parameter is required. |
| 400 | MissingParameter.InstanceIdNotSupported | InstanceId should not be null. | The InstanceId parameter is required. |
| 400 | ChargeTypeViolation | The 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. |
| 400 | InvalidInstanceId.Released | The specified Instance is not exist. | The specified instance does not exist. Check whether the instance ID is correct. |
| 400 | InvalidInstance.PurchaseNotFound | The specified Instance has no purchase. | The specified instance cannot be purchased. |
| 400 | InvalidInstance.UnPaidOrder | The specified Instance has unpaid order. | The specified instance has a purchase order not paid for. |
| 400 | InvalidClientToken.ValueNotSupported | The ClientToken provided is invalid. | The specified ClientToken parameter is invalid. |
| 400 | Account.Arrearage | Your account has been in arrears. | Your account does not have enough balance. Please add funds to your account. |
| 400 | Idempotence.SignatureMismatch | There is a idempotence signature mismatch between this and last request. | The ClientToken value is the same in the current and previous requests but the other parameters in these requests do not match. |
| 400 | OrderCreationFailed | Order creation failed. Please check your parameters and try again later. | |
| 400 | Throttling | Request was denied due to request throttling. Please try again after 5 minutes. | |
| 400 | InstanceDowngrade.QuotaExceed | Quota of instance downgrade is exceed. | The maximum number of configuration downgrades allowed for the instance has been reached. |
| 400 | InvalidInstanceId.NotFound | The specified InstanceId does not exist. | |
| 400 | InvalidDisk.DetachedSystemDisk | The current operation is not supported because the specified resource is/has a detached system disk. Please attach the disk or verify the resource state and try again. | |
| 400 | LastOrderProcessing | The previous order is still processing. Please try again later. | The previous order is still processing. Please try again later. |
| 400 | InvalidAction.WithActiveElasticUpgrade | The instance has active Elastic Upgrade. | |
| 400 | DISK_IN_DEDICATED_BLOCK_STORAGE_CLUSTER | The disk in dedicated block storage cluster is not allowed to do this operation. | |
| 400 | NoPermission.Price | The operation requires price permission. Please either apply for permission from your main account or set the parameter AutoPay to true. | |
| 400 | NoPermission.Refund | The operation requires refund permission. Please apply for permission from your main account. | This account does not have permission to operate refund, and the main account needs to authorize refund-related permissions. |
| 400 | InvalidOperation.DiskMustAttachedToInstance | The specified data disks must have been attached to this instance. | The specified disk must have been attached to this instance. |
| 400 | InstanceExpiredOrInArrears | The specified operation is denied as your prepay instance is expired (prepay mode) or in arrears (afterpay mode). | The subscription instance has expired. You must renew the instance before you can proceed. |
| 400 | InvalidOrder.Overdue | The specified account has overdue orders. | Your account has an overdue payment. You must complete the payment before you can purchase more instances. |
| 400 | IncorrectInstanceStatus | The current status of the instance does not support this operation. | The instance is in a state that does not support the current operation. |
| 400 | InvalidOperation.RenewDowngradeNotEffective | The current instance has a renewal downgrade record that has not yet taken effect. | The current instance has a renewal downgrade record that has not yet taken effect. |
| 400 | OperationDenied.UnfinishedOrder | The current instance has unfinished refundOrder, this operation is denied. | The instance has an unfinished refund order. Wait and try again later. |
| 500 | InternalError | The request processing has failed due to an internal error and you may retry later or contact support with the request ID. | |
| 403 | InvalidInstanceType.ValueNotSupported | The specified InstanceType is not supported. | |
| 403 | InvalidAccountStatus.NotEnoughBalance | Your account does not have enough balance. | |
| 403 | Throttling | Request was denied due to request throttling. Please try again after 5 minutes. | |
| 403 | InvalidInstanceChargeType.NotFound | The chargeType of the instance does not support this operation. | The operation is not supported while the instance is using the current billing method. |
| 403 | InvalidOperation.MultiAttachDisk | The specified multi-attach disk does not support the current operation. Please select another disk and try again. | |
| 403 | InvalidOperation.UnpaidOrder | The specified instance has unpaid orders and does not support the current operation. | The specified instance has unpaid orders and does not support the current operation. |
| 403 | OperationDenied | The specified InstanceType or Zone is not available or not authorized. | The specified instance type or zone is unavailable or you are not authorized to use the specified instance type or access the specified zone. |
| 403 | IncorrectDiskStatus | The operation is not supported in this status. | The disk is in a state that does not support the current operation. Make sure that the disk is available and that your account has no overdue payments. |
| 404 | InvalidRegionId.NotFound | The RegionId provided does not exist. | The specified region does not exist. |
| 404 | PaymentMethodNotFound | No billing method has been registered on the account. | The account does not have a registered payment method. |
| 404 | InvalidZoneId.NotFound | The ZoneId provided does not exist in our records. | |
| 404 | InvalidRamRole.NotFound | The specified parameter "RAMRoleName" does not exist. | The specified RAM role name does not exist. |
| 404 | InvalidDiskIds.NotFound | Some of the specified data disks do not exist. | Some disks specified by the DiskIds parameter do not exist. |
| 404 | InvalidDiskIds.NotPortable | The specified DiskId is not portable. | |
| 404 | InvalidDataDiskSize.ValueNotSupported | The specified parameter "Size" is not supported. | |
| 404 | InvalidAction.NotSupported | The specified action is not supported. | The specified API operation is not supported. |
| 404 | InvalidInstanceStatus.NotSupported | The status of the specified instance is invalid. | The instance is in a state that does not support the current operation. |
| 404 | InvalidInstanceId.NOT_FOUND | The specified instance is not exist. | The specified instance does not exist. |
| 404 | InvalidInstanceId.NotFound | The specified InstanceId does not exist. | The specified instanceId is invalid. |
See Error Codes for a complete list.
Release notes
See Release Notes for a complete list.