ModifyInstanceAutoRenewAttribute

更新时间:
复制 MD 格式

Modifies the auto-renewal attributes of one or more subscription instances, helping you reduce the maintenance cost of resource expiration.

Operation description

Before using this API, make sure you fully understand the billing methods and pricing of Elastic Compute Service (ECS).

  • Make sure your account balance or credit limit is sufficient.

  • Only subscription instances are supported. An error is returned if you call this API for pay-as-you-go instances.

  • The auto-renewal deduction date is 9 days before the instance expires. The deduction starts at 08:00:00 (UTC+8).

  • If the auto-deduction fails on the previous day, it will be retried at the scheduled time on the next day until the deduction succeeds or the instance is locked after expiration 9 days later.

  • If the purchase duration of a newly created instance is one week, the auto-renewal deduction is made on the first day after the instance is created.

Try it now

Try this API in OpenAPI Explorer, no manual signing needed. Successful calls auto-generate SDK code matching your parameters. Download it with built-in credential security for local usage.

Test

RAM authorization

The table below describes the authorization required to call this API. You can define it in a Resource Access Management (RAM) policy. The table's columns are detailed below:

  • Action: The actions can be used in the Action element of RAM permission policy statements to grant permissions to perform the operation.

  • API: The API that you can call to perform the action.

  • Access level: The predefined level of access granted for each API. Valid values: create, list, get, update, and delete.

  • Resource type: The type of the resource that supports authorization to perform the action. It indicates if the action supports resource-level permission. The specified resource must be compatible with the action. Otherwise, the policy will be ineffective.

    • For APIs with resource-level permissions, required resource types are marked with an asterisk (*). Specify the corresponding Alibaba Cloud Resource Name (ARN) in the Resource element of the policy.

    • For APIs without resource-level permissions, it is shown as All Resources. Use an asterisk (*) in the Resource element of the policy.

  • Condition key: The condition keys defined by the service. The key allows for granular control, applying to either actions alone or actions associated with specific resources. In addition to service-specific condition keys, Alibaba Cloud provides a set of common condition keys applicable across all RAM-supported services.

  • Dependent action: The dependent actions required to run the action. To complete the action, the RAM user or the RAM role must have the permissions to perform all dependent actions.

Action

Access level

Resource type

Condition key

Dependent action

ecs:ModifyInstanceAutoRenewAttribute

update

*Instance

acs:ecs:{#regionId}:{#accountId}:instance/{#instanceId}

None None

Request parameters

Parameter

Type

Required

Description

Example

InstanceId

string

Yes

Instance ID. You can specify up to 100 subscription instances at a time. Separate multiple instance IDs with commas (,).

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

RegionId

string

Yes

The region ID of the instance. You can call DescribeRegions to view the latest list of Alibaba Cloud regions.

cn-hangzhou

Duration

integer

No

The auto-renewal duration of the instance.

  • When PeriodUnit is set to Year, the valid values of Duration are: {"1", "2", "3", "4", "5"}

  • When PeriodUnit is set to Month, the valid values of Duration are: {"1", "2", "3", "6", "12", "24", "36", "48", "60"}

  • When PeriodUnit is set to Week, the valid values of Duration are: {"1", "2", "3", "4"}

1

AutoRenew

boolean

No

Specifies whether to automatically renew the instance before it expires.

  • true: enables auto-renewal.

  • false: disables auto-renewal.

Default value: false.

true

RenewalStatus

string

No

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

  • AutoRenewal: enables auto-renewal.

  • Normal: disables auto-renewal.

  • NotRenewal: does not renew the instance. After this value is set, the system no longer sends expiration reminders and only sends a non-renewal reminder three days before the instance expires. ECS instances that are set to not renew can be changed to pending renewal (Normal), and then manually renewed or set to auto-renewal.

Note

The RenewalStatus parameter takes precedence over the AutoRenew parameter. If the RenewalStatus parameter is not specified, the AutoRenew parameter takes effect by default.

AutoRenewal

PeriodUnit

string

No

The unit of the renewal duration, that is, the unit of the Duration parameter. Valid values:

  • Week

  • Month (default)

  • Year

Month

Response elements

Element

Type

Description

Example

object

RequestId

string

The request ID.

473469C7-AA6F-4DC5-B3DB-A3DC0DE3C83E

Examples

Success response

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.
500 InternalError The request processing has failed due to some unknown error.
403 MissingParameter.InstanceId InstanceId should not be null. The InstanceId parameter is required.
403 InvalidParameter.ToManyInstanceIds InstanceId should be less 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.
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.
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.

See Error Codes for a complete list.

Release notes

See Release Notes for a complete list.