Configures auto-renewal for one or more subscription instances. To reduce the maintenance workloads when instances expire, you can configure auto-renewal for subscription instances.
Description
Before you call this operation, make sure that you understand the billing methods and pricing schedule of ECS. For more information, see the Elastic Compute Service product page.
The payment for auto-renewal is first deducted automatically at 08:00:00 (UTC+8) nine days before the instance expires.
- If the first deduction attempt fails, Alibaba Cloud attempts to deduct the payment each 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
Request parameters
Parameter | Type | Required | Example | Description |
---|---|---|---|---|
Action | String | Yes | ModifyInstanceAutoRenewAttribute | The operation that you want to perform. Set the value to ModifyInstanceAutoRenewAttribute. |
InstanceId | String | Yes | i-bp67acfmxazb4ph****,i-bp67acfmxazb4pi**** | The ID of the instance. You can specify IDs of up to 100 subscription instances. Separate the instance IDs with commas (,). |
RegionId | String | Yes | cn-hangzhou | The region ID of the instance. You can call the DescribeRegions operation to query the most recent list of regions. |
Duration | Integer | No. | 1 | The auto-renewal period for the instance.
|
AutoRenew | Boolean | No | true | Specifies whether to enable auto-renewal for the instance. Default value: false. |
RenewalStatus | String | No | AutoRenewal | The auto-renewal state of the instance. Valid values:
Note RenewalStatus takes precedence over AutoRenew . If you do not specify RenewalStatus , the AutoRenew parameter is used by default. |
PeriodUnit | String | No | Month | The unit of the renewal period (
|
Response parameters
Parameter | Type | Example | Description |
---|---|---|---|
RequestId | String | 473469C7-AA6F-4DC5-B3DB-A3DC0DE3C83E | The ID of the region. |
Examples
Sample requests
https://ecs.aliyuncs.com/?Action=ModifyInstanceAutoRenewAttribute
&RegionId=cn-hangzhou
&InstanceId=i-bp67acfmxazb4ph****,i-bp67acfmxazb4pi****
&Duration=1
&PeriodUnit=Month
&AutoRenew=true
&<Common request parameters>
Sample success responses
XML
format
HTTP/1.1 200 OK
Content-Type:application/xml
<ModifyInstanceAutoRenewAttributeResponse>
<RequestId>473469C7-AA6F-4DC5-B3DB-A3DC0DE3C83E</RequestId>
</ModifyInstanceAutoRenewAttributeResponse>
JSON
format
HTTP/1.1 200 OK
Content-Type:application/json
{
"RequestId" : "473469C7-AA6F-4DC5-B3DB-A3DC0DE3C83E"
}
Error codes
HTTP status code | Error code | Error message | Description |
---|---|---|---|
403 | MissingParameter.InstanceId | InstanceId should not be null. | The error message returned because the InstanceId parameter is not specified. |
403 | InvalidParameter.ToManyInstanceIds | InstanceId should be less than 100. | The error message returned because the total number of instances has exceeded 100. |
403 | InvalidParameter.InvalidInstanceId | %s | The error message returned because the specified InstanceId parameter is invalid. |
403 | IncorrectInstanceStatus | The current status of the resource does not support this operation. | The error message returned because the operation is not supported while the resource is in the current state. |
403 | ChargeTypeViolation | Pay-As-You-Go instances do not support this operation. | The error message returned because the operation is not supported by pay-as-you-go instances. Check the billing method of the instance. |
403 | InvalidParameter.Duration | %s | The error message returned because the specified Period parameter is invalid. |
403 | InvalidParameter.RenewalStatus | %s | The error message returned because the specified RenewalStatus parameter is invalid. |
403 | InvalidPeriodUnit.ValueNotSupported | The specified parameter PeriodUnit is not valid. | The error message returned because 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 error message returned because the instance was created by using 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. | The error message returned because an internal error has occurred. Try again later. |
For a list of error codes, see Service error codes.