All Products
Search
Document Center

:ModifyDiskChargeType

更新时间:Dec 27, 2023

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

Usage notes

After you change the billing method, outstanding payments are 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 the AutoPay parameter to false. In this case, an unpaid order is generated. You can log on to the Billing Management console and then go to the Orders page to 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. OpenAPI Explorer dynamically generates the sample code of the operation for different SDKs.

Request parameters

Parameter

Type

Required

Example

Description

Action String Yes ModifyDiskChargeType

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

InstanceId String Yes i-bp1i778bq705cvx1****

The ID of the instance to which disks are attached.

RegionId String Yes cn-hangzhou

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

DiskIds String Yes ["d-bp67acfmxazb4ph****", "d-bp67acfmxazb4pi****",... "d-bp67acfmxazb4pj****"]

The disk IDs. Set this parameter to a JSON array that consists of up to 16 disk IDs. Separate the disk IDs with commas (,).

AutoPay Boolean No true

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 is canceled.
  • false: An order is generated but no payment is made. If your account balance is insufficient, an unpaid order is generated. You can log on to the Billing Management console and pay for the order on the Orders page.
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 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 How to ensure idempotence.

DiskChargeType String No PostPaid

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.

Response parameters

Parameter

Type

Example

Description

OrderId String 123456****

The ID of the order.

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

The ID of the request.

Examples

Sample requests

http(s)://ecs.aliyuncs.com/?Action=ModifyDiskChargeType
&DiskIds=["d-bp67acfmxazb4ph****", "d-bp67acfmxazb4pi****", … "d-bp67acfmxazb4pj****"]
&InstanceId=i-bp1i778bq705cvx1****
&RegionId=cn-hangzhou
&AutoPay=true
&ClientToken=123e4567-e89b-12d3-a456-426655440000
&DiskChargeType=PostPaid
&<Common request parameters>

Sample success responses

XML format

HTTP/1.1 200 OK
Content-Type:application/xml

<ModifyDiskChargeTypeResponse>
    <OrderId>123456****</OrderId>
    <RequestId>473469C7-AA6F-4DC5-B3DB-A3DC0DE3C83E</RequestId>
</ModifyDiskChargeTypeResponse>

JSON format

HTTP/1.1 200 OK
Content-Type:application/json

{
  "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. You are not authorized to use the instance type.
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. RegionId is required.
400 MissingParameter.InstanceIdNotSupported InstanceId should not be null. InstanceId is required.
400 ChargeTypeViolation The operation is not permitted due to charge type of the instance. This operation cannot be performed on the instance that uses the current billing method.
400 InvalidInstanceId.Released The specified Instance is not exist. The specified instance is not found. 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. You have unpaid orders for the specified instance. Pay for the orders and try again.
400 InvalidClientToken.ValueNotSupported The ClientToken provided is invalid. Invalid ClientToken value.
400 Account.Arrearage Your account has been in arrears. Your account balance is insufficient. Add funds to your account and try again.
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 InvalidInstanceType.ValueUnauthorized The specified InstanceType is not Supported. You are not authorized to use the instance type.
400 OrderCreationFailed Create Order failed, please check your parameters and try it later. The order cannot be created. Check your parameter settings and try again.
400 Throttling Request was denied due to request throttling, please try again after 5 minutes. Your request is denied due to throttling. Try again 5 minutes later.
400 InstanceDowngrade.QuotaExceed Quota of instance downgrade is exceed. The maximum number of configuration downgrades allowed for the instance is exceeded.
400 InvalidInstanceId.NotFound The specified InstanceId does not exist. This instance is not found. Check whether the specified instance ID is valid.
400 LastOrderProcessing The previous order is still processing, please try again later. The order is being processed. Try again later.
400 InvalidAction.WithActiveElasticUpgrade The instance has active Elastic Upgrade. The operation is not supported while the configurations of the instance are being temporarily upgraded. The configurations of the instance go through a temporary upgrade when the ModifyPrepayInstanceSpec operation is called with the EndTime parameter set.
403 Forbidden %s You are not authorized to use the specified resource.
403 InvalidAccountStatus.NotEnoughBalance Your account does not have enough balance. Your account balance is insufficient. Add funds to your account and try again.
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. You cannot perform the operation on the disk for which the multi-attach feature is enabled.
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. You have not selected a payment method. Select a payment method and try again.
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. The disk is not removable.
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. This operation cannot be performed on the instance in the current state.
404 InvalidInstanceId.NOT_FOUND The specified instance is not exist. The specified instance is not found.
500 InternalError The request processing has failed due to some unknown error. An internal error occurred. Try again later.

For a list of error codes, see Service error codes.