Configures auto-renewal for subscription instances to help reduce the maintenance workloads on instance expiration.
Operation description
Before you call this operation, make sure that you are familiar with the billing methods and pricing of Elastic Compute Service (ECS). For more information, see the Elastic Compute Service product page.
- The payment for auto-renewal of an instance is automatically deducted at 08:00:00 (UTC+8) nine days before the instance expires.
- If the deduction fails, Alibaba Cloud attempts to deduct the payment every day until the payment is deducted or until the instance is locked after the nine-day period ends. Make sure that your account balance or credit balance is sufficient.
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 |
---|---|---|---|---|
ecs:ModifyInstanceAutoRenewAttribute | update | *Instance acs:ecs:{#regionId}:{#accountId}:instance/{#instanceId} |
| none |
Request parameters
Parameter | Type | Required | Description | Example |
---|---|---|---|---|
InstanceId | string | Yes | The ID of the instance. You can specify up to 100 subscription instance IDs. Separate the instance IDs with commas (,). | i-bp67acfmxazb4ph****,i-bp67acfmxazb4pi**** |
RegionId | string | Yes | The region ID of the instance. You can call the DescribeRegions operation to query the most recent region list. | cn-hangzhou |
Duration | integer | No | The auto-renewal period of the instance.
| 1 |
AutoRenew | boolean | No | Specifies whether to enable auto-renewal. Default value: false. | true |
RenewalStatus | string | No | The auto-renewal status of the instance. Valid values:
Note
RenewalStatus takes precedence over AutoRenew . If you do not specify RenewalStatus , AutoRenew is used by default.
| AutoRenewal |
PeriodUnit | string | No | The unit of the renewal period (
| Month |
Response parameters
Examples
Sample success responses
JSON
format
{
"RequestId": "473469C7-AA6F-4DC5-B3DB-A3DC0DE3C83E"
}
Error codes
HTTP status code | Error code | Error message | Description |
---|---|---|---|
400 | OperationDenied.StarterPackage | Instance created with a Starter Package plan can not set auto renew. | - |
403 | MissingParameter.InstanceId | InstanceId should not be null. | The InstanceId parameter is required. |
403 | InvalidParameter.ToManyInstanceIds | InstanceId should be less than 100. | The number of instances must be smaller than 100. |
403 | InvalidParameter.InvalidInstanceId | %s | The specified InstanceId parameter is invalid. |
403 | IncorrectInstanceStatus | The current status of the resource does not support this operation. | The resource is in a state that does not support the current operation. |
403 | ChargeTypeViolation | Pay-As-You-Go instances do not support this operation. | The operation is not supported by pay-as-you-go instances. Check the billing method of the instance. |
403 | InvalidParameter.Duration | %s | The specified Duration parameter is invalid. |
403 | InvalidParameter.RenewalStatus | %s | The specified RenewalStatus parameter is invalid. |
403 | InvalidPeriodUnit.ValueNotSupported | The specified parameter PeriodUnit is not valid. | The specified PeriodUnit parameter is invalid. |
403 | InvalidPeriod.StarterPackage | This instance was created by using a Starter Package plan and can only be renewed monthly, not yearly. | The instance was created in a Starter Package plan and can only be automatically renewed on a monthly basis. |
500 | InternalError | The 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 time | Summary of changes | Operation |
---|