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

OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer. OpenAPI Explorer dynamically generates the sample code of the operation for different SDKs.

Request parameters

ParameterTypeRequiredExampleDescription
ActionStringYesModifyInstanceAutoRenewAttribute

The operation that you want to perform. Set the value to ModifyInstanceAutoRenewAttribute.

InstanceIdStringYesi-bp67acfmxazb4ph****,i-bp67acfmxazb4pi****

The ID of the instance. You can specify IDs of up to 100 subscription instances. Separate the instance IDs with commas (,).

RegionIdStringYescn-hangzhou

The region ID of the instance. You can call the DescribeRegions operation to query the most recent list of regions.

DurationIntegerNo.1

The auto-renewal period for the instance.

  • Valid values of Duration when PeriodUnit is set to Year (year): 1, 2, 3, 4, and 5.
  • Valid values of Duration when PeriodUnit is set to Month (month): 1, 2, 3, 6, 12, 24, 36, 48, and 60.
AutoRenewBooleanNotrue

Specifies whether to enable auto-renewal for the instance.

Default value: false.

RenewalStatusStringNoAutoRenewal

The auto-renewal state of the instance. Valid values:

  • AutoRenewal: Auto-renewal is enabled for the instance.
  • Normal: Auto-renewal is disabled for the instance.
  • NotRenewal: The instance is not renewed. The system no longer sends an expiration notification. Notifications for renewal are sent three days before the expiration time of the instance. You can change the value of this parameter from NotRenewal to Normal for an instance, and then manually renew the instance. Alternatively, you can set the RenewalStatus parameter to AutoRenewal.
Note RenewalStatus takes precedence over AutoRenew. If you do not specify RenewalStatus, the AutoRenew parameter is used by default.
PeriodUnitStringNoMonth

The unit of the renewal period (Duration). Default value: Month. Valid values:

  • Month
  • Year

Response parameters

ParameterTypeExampleDescription
RequestIdString473469C7-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 codeError codeError messageDescription
403MissingParameter.InstanceIdInstanceId should not be null.The error message returned because the InstanceId parameter is not specified.
403InvalidParameter.ToManyInstanceIdsInstanceId should be less than 100.The error message returned because the total number of instances has exceeded 100.
403InvalidParameter.InvalidInstanceId%sThe error message returned because the specified InstanceId parameter is invalid.
403IncorrectInstanceStatusThe 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.
403ChargeTypeViolationPay-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.
403InvalidParameter.Duration%sThe error message returned because the specified Period parameter is invalid.
403InvalidParameter.RenewalStatus%sThe error message returned because the specified RenewalStatus parameter is invalid.
403InvalidPeriodUnit.ValueNotSupportedThe specified parameter PeriodUnit is not valid.The error message returned because the specified PeriodUnit parameter is invalid.
403InvalidPeriod.StarterPackageThis 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.
500InternalErrorThe 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.