All Products
Search
Document Center

Elastic Compute Service:ModifyDiskChargeType

Last Updated:Sep 02, 2026

Converts the billing method of data disks attached to a subscription ECS instance between pay-as-you-go and subscription.

Operation description

Before you convert the billing method of data disks, read Change the billing method of a disk.

Take note of the following items when you call this operation:

  • You cannot change the billing method of data disks attached to pay-as-you-go instances. Pay-as-you-go instances support only pay-as-you-go disks.

  • The instance to which the data disks are attached cannot be in the expired and stopped state.

  • The price difference before and after the billing method change is refunded to your original payment method. Consumed coupons are not refundable.

  • After the billing method of a disk is successfully changed, you must wait at least five minutes before you can change it again.

After the billing method is changed, automatic payment is enabled by default. Make sure that your account balance is sufficient. Otherwise, an abnormal order is generated, and you can only void the order. If your account balance is insufficient, you can set the AutoPay parameter to false. In this case, an unpaid order is generated. You can log on to the Alibaba Cloud Expenses and Costs console and go to the Orders page to complete the payment.

Try it now

Try this API in OpenAPI Explorer, no manual signing needed. Successful calls auto-generate SDK code matching your parameters. Download it with built-in credential security for local usage.

Test

RAM authorization

The table below describes the authorization required to call this API. You can define it in a Resource Access Management (RAM) policy. The table's columns are detailed below:

  • Action: The actions can be used in the Action element of RAM permission policy statements to grant permissions to perform the operation.

  • API: The API that you can call to perform the action.

  • Access level: The predefined level of access granted for each API. Valid values: create, list, get, update, and delete.

  • Resource type: The type of the resource that supports authorization to perform the action. It indicates if the action supports resource-level permission. The specified resource must be compatible with the action. Otherwise, the policy will be ineffective.

    • For APIs with resource-level permissions, required resource types are marked with an asterisk (*). Specify the corresponding Alibaba Cloud Resource Name (ARN) in the Resource element of the policy.

    • For APIs without resource-level permissions, it is shown as All Resources. Use an asterisk (*) in the Resource element of the policy.

  • Condition key: The condition keys defined by the service. The key allows for granular control, applying to either actions alone or actions associated with specific resources. In addition to service-specific condition keys, Alibaba Cloud provides a set of common condition keys applicable across all RAM-supported services.

  • Dependent action: The dependent actions required to run the action. To complete the action, the RAM user or the RAM role must have the permissions to perform all dependent actions.

Action

Access level

Resource type

Condition key

Dependent action

ecs:ModifyDiskChargeType

update

*Instance

acs:ecs:{#regionId}:{#accountId}:instance/{#instanceId}

None None

Request parameters

Parameter

Type

Required

Description

Example

InstanceId

string

Yes

The instance ID of the instance to which the disks are 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 that contains 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 (default): Automatic payment is enabled. Make sure that your account balance is sufficient. If your account balance is insufficient, an abnormal order is generated, and you can only void the order.

  • false: An order is generated but payment is not automatically completed. If your account balance is insufficient, an unpaid order is generated. You can log on to the Alibaba Cloud Expenses and Costs console and go to the Orders page to complete the payment.

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 make sure that the token is unique among different requests. The ClientToken value can contain only ASCII characters and cannot exceed 64 characters in length. For more information, see How to ensure idempotence.

123e4567-e89b-12d3-a456-426655440000

DiskChargeType

string

No

The billing method of the disk. Valid values:

  • PrePaid (default): Converts pay-as-you-go data disks to subscription data disks.

  • PostPaid: Converts subscription data disks to pay-as-you-go data disks.

Note

When you convert pay-as-you-go disks to subscription, the billing cycle of the capacity fee is automatically synchronized with the associated ECS instance.

PostPaid

Response elements

Element

Type

Description

Example

object

OrderId

string

The order ID.

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 specified disk is a detached system disk. This operation is not supported.
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.
500 InternalError The request processing has failed due to some unknown error.
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 Multi attach disk does not support this operation. Disks for which the multi-attach feature is enabled do not support the operation.
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.
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 has not registered a 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 RamRoleName 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.