All Products
Search
Document Center

Elastic Compute Service:ModifyDiskChargeType

Last Updated:Sep 29, 2024

Changes the billing method of data disks that are attached to a subscription Elastic Compute Service (ECS) instance.

Operation description

Usage notes

After you change the billing method, the payment (if any) is automatically completed. Maintain sufficient balance in your account. Otherwise, your order becomes invalid and must be canceled. If your account balance is insufficient, you can set AutoPay to false to generate an unpaid order. Then, log on to the Expenses and Costs console, go to the Orders page, and pay for the order.

Take note of the following items:

  • Only pay-as-you-go disks can be attached to pay-as-you-go instances, and the billing methods of the disks cannot be changed.
  • The instance cannot be in the Stopped state due to expiration.
  • The price difference is refunded to the payment account that you used. Vouchers that have been redeemed are nonrefundable.
  • You cannot change the billing method again within 5 minutes of a successful change.

Debugging

OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer.

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:ModifyDiskChargeTypeupdate
  • Instance
    acs:ecs:{#regionId}:{#accountId}:instance/{#instanceId}
    none
none

Request parameters

ParameterTypeRequiredDescriptionExample
InstanceIdstringYes

The ID of the instance to which disks are attached.

i-bp1i778bq705cvx1****
RegionIdstringYes

The region ID of the instance. You can call the DescribeRegions operation to query the most recent region list.

cn-hangzhou
DiskIdsstringYes

The IDs of disks. The value is a JSON array that consists of up to 16 disk IDs. Separate the disk IDs with commas (,).

[“d-bp67acfmxazb4ph****”, “d-bp67acfmxazb4pi****”, … “d-bp67acfmxazb4pj****”]
AutoPaybooleanNo

Specifies whether to automatically complete the payment. Valid values:

  • true (default): The payment is automatically completed. Maintain sufficient balance in your account. Otherwise, your order becomes invalid and must be canceled.
  • false: An order is generated but no payment is made. If your account balance is insufficient, you can set AutoPay to false to generate an unpaid order. Then, log on to the Expenses and Costs console, go to the Orders page, and pay for the order.
true
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 Ensure idempotence.

123e4567-e89b-12d3-a456-426655440000
DiskChargeTypestringNo

The new billing method of the disk. Valid values:

  • PrePaid (default): changes the billing method from pay-as-you-go to subscription.
  • PostPaid: changes the billing method from subscription to pay-as-you-go.
PostPaid

Response parameters

ParameterTypeDescriptionExample
object
OrderIdstring

The ID of the order.

1234567890
RequestIdstring

The request ID.

473469C7-AA6F-4DC5-B3DB-A3DC0DE3C83E

Examples

Sample success responses

JSONformat

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

Error codes

HTTP status codeError codeError messageDescription
400InvalidInstanceType.ValueUnauthorizedThe specified InstanceType is not authorized.You are not authorized to use the specified instance type.
400InvalidInstanceType.ValueNotSupportedThe specified InstanceType is not supported.The specified instance type is not supported. Try another instance type.
400MissingParameter.RegionIdRegionId should not be null.The RegionId parameter is required.
400MissingParameter.InstanceIdNotSupportedInstanceId should not be null.The InstanceId parameter is required.
400ChargeTypeViolationThe 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.
400InvalidInstanceId.ReleasedThe specified Instance is not exist.The specified instance does not exist. Check whether the instance ID is correct.
400InvalidInstance.PurchaseNotFoundThe specified Instance has no purchase.The specified instance cannot be purchased.
400InvalidInstance.UnPaidOrderThe specified Instance has unpaid order.The specified instance has a purchase order not paid for.
400InvalidClientToken.ValueNotSupportedThe ClientToken provided is invalid.The specified ClientToken parameter is invalid.
400Account.ArrearageYour account has been in arrears.Your account does not have enough balance. Please add funds to your account.
400Idempotence.SignatureMismatchThere 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.
400InvalidInstanceType.ValueUnauthorizedThe specified InstanceType is not Supported.You are not authorized to use the instance type.
400OrderCreationFailedCreate Order failed, please check your parameters and try it later.-
400ThrottlingRequest was denied due to request throttling, please try again after 5 minutes.-
400InstanceDowngrade.QuotaExceedQuota of instance downgrade is exceed.The maximum number of configuration downgrades allowed for the instance has been reached.
400ChargeTypeViolationThe operation is not permitted due to charge type of the disk.-
400InvalidInstanceId.NotFoundThe specified InstanceId does not exist.The specified instance does not exist.
400InvalidDisk.DetachedSystemDiskThe specified disk is a detached system disk, does not support this operation.-
400LastOrderProcessingThe previous order is still processing, please try again later.The order is being processed. Try again later.
400InvalidAction.WithActiveElasticUpgradeThe instance has active Elastic Upgrade.The operation is not supported while the instance are being temporarily upgraded. The instance goes through a temporary configuration upgrade if the EndTime parameter is specified to call the ModifyPrepayInstanceSpec operation.
400DISK_IN_DEDICATED_BLOCK_STORAGE_CLUSTERThe disk in dedicated block storage cluster is not allowed to do this operation.-
400NoPermission.PriceThe operation requires price permission. Please either apply for permission from your main account, or set the parameter AutoPay as true.-
400NoPermission.RefundThe operation requires refund permission. Please apply for permission from your main account.-
403Forbidden%sYou are not authorized to use the specified resource.
403InvalidAccountStatus.NotEnoughBalanceYour account does not have enough balance.Your account balance is insufficient. Add funds to your account and try again.
403InvalidInstanceChargeType.NotFoundThe chargeType of the instance does not support this operation.The operation is not supported while the instance is using the current billing method.
403InvalidOperation.MultiAttachDiskMulti attach disk does not support this operation.Disks for which the multi-attach feature is enabled do not support the operation.
404InvalidRegionId.NotFoundThe RegionId provided does not exist.The specified region does not exist.
404PaymentMethodNotFoundNo billing method has been registered on the account.-
404InvalidZoneId.NotFoundThe ZoneId provided does not exist in our records.The specified zone ID does not exist.
404InvalidRamRole.NotFoundThe specified parameter "RAMRoleName" does not exist.-
404InvalidDiskIds.NotFoundSome of the specified data disks do not exist.Some disks specified by the DiskIds parameter do not exist.
404InvalidDiskIds.NotPortableThe specified DiskId is not portable.The specified disk is not removable.
404InvalidDataDiskSize.ValueNotSupportedThe specified parameter "Size" is not supported.-
404InvalidAction.NotSupportedThe specified action is not supported.The specified API operation is not supported.
404InvalidInstanceStatus.NotSupportedThe status of the specified instance is invalid.The instance is in a state that does not support the current operation.
404InvalidInstanceId.NOT_FOUNDThe specified instance is not exist.The specified instance does not exist.
404InvalidDiskIds.NotPortableThe specified disk is not portable.-
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
No change history