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 |
Specifies the IDs of ECSs whose billing modes are to be changed from pay-per-use to yearly/monthly. |
charge_mode |
Yes |
String |
Specifies the new billing mode. prePaid: Change the billing mode to yearly/monthly. |
prepaid_options |
No |
Object |
Specifies the yearly/monthly billing mode. This parameter is mandatory when charge_mode is set to prePaid. For details, see Table 3. |
dry_run |
No |
Boolean |
Specifies whether to check the request and change the billing mode.
The default value is false. |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
include_data_disks |
No |
Boolean |
Specifies whether to change the billing modes of all pay-per-use data disks to yearly/monthly. If this parameter is true, the billing modes of non-shared pay-per-use disks are changed to yearly/monthly. The billing modes of ECSs that have shared EVS disks, DSS disks, or DESS disks attached cannot be changed. The default value is false. |
include_publicips |
No |
Boolean |
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. The default value is false. |
period_type |
Yes |
String |
Specifies the subscription period. Value options:
|
period_num |
Yes |
String |
Specifies the number of subscription periods. Value range:
|
auto_pay |
No |
Boolean |
Specifies whether to enable automatic payment. Value options:
The default value is false. |
auto_renew |
No |
Boolean |
Specifies whether to enable auto-renewal. Value options:
The default value is 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 Value
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