All Products
Document Center

Elastic Compute Service:ModifyDedicatedHostsChargeType

Last Updated:Apr 11, 2024

Changes the billing method of dedicated hosts.


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

Authorization information

There is currently no authorization information disclosed in the API.

Request parameters


The IDs of the dedicated hosts. The value can be a JSON array that consists of up to 20 dedicated host IDs. Separate the IDs with commas (,).


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


The renewal duration of the subscription dedicated hosts. Valid values:

  • If you set PeriodUnit to Week, valid values of Period are 1, 2, 3, and 4.
  • If you set PeriodUnit to Month, valid values of Period are 1, 2, 3, 4, 5, 6, 7, 8, 9, 12, 24, 36, 48, and 60.

The unit of the renewal duration specified by Period. Valid values:

  • Week
  • Month

Default value: Month.


Specifies whether to perform only a dry run, without performing the actual request. Valid values:

  • true: performs only a dry run. The system checks your AccessKey pair, the permissions of the RAM user, and the required parameters. If the request fails the dry run, an error message is returned. If the request passes the dry run, the DryRunOperation error code is returned.
  • false: performs a dry run and performs the actual request. If the request passes the dry run, a 2xx HTTP status code is returned and the operation is performed.

Default value: false.


Specifies whether to automatically complete the payment. Valid values:

  • true: The payment is automatically completed. Make sure that your account balance is sufficient. Otherwise, your order becomes invalid and will be canceled.
  • false: An order is generated but no payment is made.

Default value: true.

Note If you do not have sufficient balance in your account, you can set AutoPay to false to generate an unpaid order. Then, you can pay for the order.

The new billing method of the dedicated hosts. Valid 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.


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.


Specifies whether to return the billing details of the order when the billing method is changed from subscription to pay-as-you-go.

Default value: false.


Response parameters


The order ID.


The request ID.

FeeOfInstancesobject []

Details about the charges for the order.


The IDs of the dedicated hosts.


The unit of currency for the bill.

Alibaba Cloud China site ( CNY

Alibaba Cloud International site ( USD


The charged amount.



Sample success responses


  "OrderId": "20413515388****",
  "RequestId": "B61C08E5-403A-46A2-96C1-F7B1216DB10C",
  "FeeOfInstances": {
    "FeeOfInstance": [
        "InstanceId": "dh-bp181e5064b5sotrr****",
        "Currency": "CNY",
        "Fee": "0"

Error codes

HTTP status codeError codeError messageDescription
400InvalidParameter.InstanceIdsThe specified InstanceIds are invalid.The specified instance is invalid.
400InvalidParameter%sThe specified parameter is invalid.
400InvalidStatus.ValueNotSupported%sThe resource is in a state that does not support the current operation.
400InvalidInstanceChargeType.ValueNotSupported%sThe specified InstanceChargeType parameter is invalid.
400InvalidSpotStrategyThe specified spotStrategy is not valid.The specified SpotStrategy parameter is invalid.
400ExpiredInstanceThe specified instance has expired.-
400InstancesIdQuotaExceedThe maximum number of Instances is exceeded.-
400InvalidClientToken.ValueNotSupportedThe ClientToken provided is invalid.The specified ClientToken parameter is invalid.
400InvalidInstance.UnpaidOrderThe specified instance has unpaid order.The specified instance has a purchase order not paid for.
400ReleaseTimeHaveBeenSetThe specified instance has been set released time.An automatic release time has been set for the specified instance.
400ThrottlingRequest was denied due to request throttling, please try again after 5 minutes.-
400Throttling%sYour request is being throttled.
400QuotaExceed.AfterpayInstanceThe maximum number of Pay-As-You-Go instances is exceeded: %s-
400QuotaExceed.RufundVcpuThe maximum number of refund vcpu is exceeded: %s-
400InvalidPeriod.UnitMismatchThe specified Period must be correlated with the PeriodUnit.The specified Period value must fall within the valid value range that is determined based on the PeriodUnit parameter.
400InvalidPeriod.ExceededDedicatedHostInstance expired date can't exceed dedicated host expired date.-
400InvalidSystemDiskCategory.ValueNotSupported%sThe specified system disk category is invalid.
400InvalidAccountStatus.PayAmountLimitExceededYour account is being restricted, due to no default payment method is set or you has not being authorized.-
403InvalidInstanceType.ValueNotSupportedThe specified InstanceType does not exist or beyond the permitted range.The specified instance type does not exist or you are not authorized to manage instances of this instance type.
403InstanceType.Offline%sThe operation is not supported while the instance type is retired or while resources of the instance type are insufficient.
403InvalidAccountStatus.NotEnoughBalanceYour account does not have enough balance.Your account balance is insufficient. Add funds to your account and try again.
403Account.ArrearageYour account has an outstanding payment.Your account has overdue payments.
403InvalidParameter.NotMatch%sA specified parameter is invalid. Check whether parameter conflicts exist.
403InvalidAction%sThe operation is invalid.
403QuotaExceed.PostPaidDiskLiving postPaid disks quota exceeded.-
403ImageNotSupportInstanceTypeThe specified instanceType is not supported by instance with marketplace image.The specified Alibaba Cloud Marketplace image does not support the instance type.
403InvalidInstanceType.PhasedOutThis instanceType is no longer offered.The specified instance type is retired.
403RealNameAuthenticationErrorYour account has not passed the real-name authentication yet.You have not completed real-name verification. Complete real-name verification and try again.
403InvalidOperation.NotSupportInstance on dedicated host not support modify charge type.-
404InvalidInstanceId.NotFoundThe specified instanceId does not exist.The specified instance does not exist.
500InternalErrorThe request processing has failed due to some unknown error, exception or failure.An internal error has occurred. Try again later.
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
2023-11-24The Error code has changedsee changesets
Change itemChange content
Error CodesThe Error code has changed.
    Error Codes 400 change
    delete Error Codes: 403
    delete Error Codes: 404
    delete Error Codes: 500