Changing the ECS Billing Mode
Function
This API is used to change the ECS billing mode.
Constraints
- This API can only be used to change the billing mode from pay-per-use to yearly/monthly.
- You can batch change the billing modes of a maximum of 10 ECSs.
- The EIP bound to the ECS whose billing mode is to be changed must be exclusive and billed by bandwidth.
- The billing modes of ECSs that have shared EVS disks, DSS disks, or DESS disks attached cannot be changed.
- If you want to use a coupon, set auto_pay in prepaid_options to false and pay for the product by referring to Paying Yearly/Monthly Product Orders, or use the coupon to pay for the product on the console.
- The billing modes of ECSs on Dedicated Hosts (DeHs), Dedicated Clouds (DeCs), and edge clouds cannot be changed.
- The billing modes of spot ECSs cannot be changed.
URI
POST /v1/{project_id}/cloudservers/actions/change-charge-mode
Parameter |
Mandatory |
Description |
---|---|---|
project_id |
Yes |
Specifies the project ID. For details about how to obtain the ID, see Obtaining a Project ID. |
Request
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
server_ids |
Yes |
Array of String |
Definition Specifies the IDs of ECSs whose billing modes are to be changed from pay-per-use to yearly/monthly. Constraints N/A Range N/A Default Value N/A |
charge_mode |
Yes |
String |
Definition Specifies the new billing mode. Constraints N/A Range prePaid: Change the billing mode to yearly/monthly. Default Value N/A |
prepaid_options |
No |
Object |
Definition Specifies the yearly/monthly billing mode. This parameter is mandatory when charge_mode is set to prePaid. For details, see Table 3. Constraints N/A Range N/A Default Value N/A |
dry_run |
No |
Boolean |
Definition Specifies whether to check the request. If this parameter is set to true, no instance is created. Constraints N/A Range
Default Value false |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
include_data_disks |
No |
Boolean |
Definition Specifies whether to change the billing modes of all pay-per-use data disks to yearly/monthly. Constraints The billing modes of ECSs that have shared EVS disks, DSS disks, or DESS disks attached cannot be changed. Range
Default Value false |
include_publicips |
No |
Boolean |
Definition Specifies whether to change the billing modes of EIPs that are exclusive and billed by bandwidth to yearly/monthly. After the EIPs are changed to yearly/monthly, they can be unbound or deleted separately. Constraints N/A Range
Default Value false |
period_type |
Yes |
String |
Definition Specifies the subscription period. Constraints N/A Range
Default Value N/A |
period_num |
Yes |
String |
Definition Specifies the number of subscription periods. Constraints N/A Range
Default Value N/A |
auto_pay |
No |
Boolean |
Definition Specifies whether to enable automatic payment. Constraints N/A Range
Default Value false |
auto_renew |
No |
Boolean |
Definition Specifies whether to enable auto-renewal. Constraints N/A Range
Default Value false |
Response
Parameter |
Type |
Description |
---|---|---|
order_id |
String |
Specifies the ID of the order for changing the billing mode to yearly/monthly. |
Example Request
Change the billing mode of an ECS and the exclusive EIP billed by bandwidth to yearly/monthly with the subscription period set to one month.
POST https://{endpoint}/v1/{project_id}/cloudservers/actions/change-charge-mode { "server_ids": [ "f631ee2c-1caf-4c4f-9cee-f3181b8e44ad" ], "charge_mode": "prePaid", "prepaid_options": { "include_publicips": true, "include_data_disks": false, "period_type": "month", "period_num": "1", "auto_pay": false, "auto_renew": false }, "dry_run": false }
Example Response
{ order_id: "CS2102041657OL0EY" }
Returned Values
Error Codes
See Error Codes.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot