All Products
Search
Document Center

Elastic Compute Service:ModifyDedicatedHostsChargeType

Last Updated:Dec 17, 2024

Changes the billing method of dedicated hosts.

Debugging

You can run this interface directly in OpenAPI Explorer, saving you the trouble of calculating signatures. After running successfully, OpenAPI Explorer can automatically generate SDK code samples.

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:ModifyDedicatedHostsChargeTypeupdate
*All Resources
*
    none
none

Request parameters

ParameterTypeRequiredDescriptionExample
DedicatedHostIdsstringYes

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 (,).

["dh-bp181e5064b5sotr****","dh-bp18064b5sotrr9c****"]
RegionIdstringYes

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

cn-hangzhou
PeriodintegerNo

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.
1
PeriodUnitstringNo

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

  • Week
  • Month

Default value: Month.

Month
DryRunbooleanNo

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.

false
AutoPaybooleanNo

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.
false
DedicatedHostChargeTypestringNo

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.

PrePaid
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 How to ensure idempotence.

e4567-e89b-12d3-a456-426655440000
DetailFeebooleanNo

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.

false

Response parameters

ParameterTypeDescriptionExample
object
OrderIdstring

The order ID.

20413515388****
RequestIdstring

The request ID.

B61C08E5-403A-46A2-96C1-F7B1216DB10C
FeeOfInstancesarray<object>

Details about the charges for the order.

FeeOfInstanceobject
InstanceIdstring

The IDs of the dedicated hosts.

dh-bp181e5064b5sotrr****
Currencystring

The unit of currency for the bill.

Alibaba Cloud China site (aliyun.com): CNY

Alibaba Cloud International site (alibabacloud.com): USD

CNY
Feestring

The charged amount.

0

Examples

Sample success responses

JSONformat

{
  "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.
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.
400InvalidImageType.NotSupported%s-
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.-
400QuotaExceed.AfterpayInstanceThe maximum number of Pay-As-You-Go instances is exceeded.-
400QuotaExceed.RufundVcpuThe maximum number of refunded vcpu is exceeded: %s .The maximum number of refund vCPUs is exceeded. For more information about the amount, see the return value of the %s placeholder in the error message.
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 changedView Change Details