Changes the billing method of Edge Node Service (ENS) instances. You can switch between the pay-as-you-go and subscription billing methods for instances. You can also change the billing method for disks that you created with pay-as-you-go instances to subscription.
Operation description
Before you call this operation, make sure that you fully understand the billing methods and pricing of ENS.
The instances must be in the Running or Stopped state, and you have no overdue payments for them.
Debugging
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.
Operation | Access level | Resource type | Condition key | Associated operation |
---|---|---|---|---|
ens:ModifyInstanceChargeType | update |
|
| none |
Request parameters
Parameter | Type | Required | Description | Example |
---|---|---|---|---|
InstanceIds | array | Yes | The IDs of the instances. | |
string | Yes | The ID of the instance. | i-5xlrc9wdeo3xxxxxx | |
InstanceChargeType | string | Yes | The new billing method. Valid values: PrePaid PostPaid (default) | PostPaid |
AutoRenew | boolean | No | Specifies whether to enable auto-renewal when you change the billing method from pay-as-you-go to subscription. Valid values: true: enables auto-renewal for the instance. false | false |
Period | string | No | The subscription duration. This parameter is required if you set the InstanceChargeType parameter to PrePaid. Valid values: If the PeriodUnit parameter is set to Day, Period can only be set to 3. If PeriodUnit is Month, Period can be set to 1 to 9 or 12. | 1 |
PeriodUnit | string | No | The unit of the subscription duration. This parameter is required if you set the InstanceChargeType parameter to PrePaid. Valid values: Month Day Enumeration Value:
| Month |
IncludeDataDisks | boolean | No | Specifies whether to change the billing method of all data disks that are created with the instance to subscription when you change the billing method of the instance from pay-as-you-go to subscription. Valid values: true false (default) | true |
AutoPay | boolean | No | Specifies whether to enable auto-payment when you change the billing method from pay-as-you-go to subscription. Valid values: true: enables auto-payment. Make sure that your account has sufficient balance. false (default): does not enable auto-payment. The order is generated but not paid. | false |
Response parameters
Examples
Sample success responses
JSON
format
{
"RequestId": "E2CE5821-7A18-5F7B-A18A-1C751B933D2A",
"InstanceIds": [
"i-5xu1chy7ckxxxx"
],
"OrderId": 0
}
Error codes
HTTP status code | Error code | Error message | Description |
---|---|---|---|
400 | VALIDATE.MODULE.FAILED | Required module is not selected. | Required module is not selected. |
400 | ens.interface.error | Failed to call API. | - |
400 | NoPermission | Permission denied. | - |
400 | InvalidParameter.%s | The specified field %s invalid. Please check it again. | - |
For a list of error codes, visit the Service error codes.
Change history
Change time | Summary of changes | Operation |
---|---|---|
2024-06-13 | The Error code has changed | View Change Details |