CreateElasticityAssurance

更新时间:
复制 MD 格式

Creates an elasticity assurance in a region. When you call this operation, you can specify parameters, such as ZoneId, InstanceType, Period, PeriodUnit, and AutoRenew, in the request.

Operation description

Elasticity Assurance provides a new method to purchase and use guaranteed resources in a flexible manner. Elasticity Assurance is a resource reservation service that provides assured access to resources for pay-as-you-go Elastic Compute Service (ECS) instances. For more information, see Overview of Elasticity Assurance.

  • After you purchase an elasticity assurance, you cannot request a refund for the elasticity assurance. For information about the billing of elasticity assurances, see Resource assurance.

  • Elasticity assurances can be used to create only pay-as-you-go ECS instances.

  • Elasticity assurances only support the unlimited mode. You can set AssuranceTimes only to Unlimited. Elasticity assurances in unlimited mode can be used for an unlimited number of times within their terms. Elasticity assurances in unlimited mode take effect immediately after creation.

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:CreateElasticityAssurance

create

*ElasticityAssurance

acs:ecs:{#regionId}:{#accountId}:elasticityassurance/*

None None

Request parameters

Parameter

Type

Required

Description

Example

RegionId

string

Yes

The ID of the region in which to create the elasticity assurance. You can call the DescribeRegions operation to query the most recent region list.

cn-hangzhou

ResourceGroupId

string

No

The ID of the resource group to which to assign the elasticity assurance.

rg-bp67acfmxazb4p****

Tag

array<object>

No

The tags to add to the elasticity assurance.

object

No

The tag to add to the elasticity assurance.

Value

string

No

The value of tag N to add to the elasticity assurance. Valid values of N: 1 to 20. The tag value can be an empty string. The tag value can be up to 128 characters in length and cannot start with acs:. The tag value cannot contain http:// or https://.

TestValue

Key

string

No

The key of tag N to add to the elasticity assurance. Valid values of N: 1 to 20. The tag key cannot be an empty string. The tag key can be up to 128 characters in length and cannot contain http:// or https://. The tag key cannot start with acs: or aliyun.

TestKey

Period

integer

No

The validity period of the elasticity assurance. The unit of the validity period is determined by the value of PeriodUnit. Specifies whether to check the image used by the instance supports hot migration. Valid values:

  • When the value of PeriodUnit is Month, the valid values are 1, 2, 3, 4, 5, 6, 7, 8, and 9.

  • When the value of PeriodUnit is Year, the valid values are 1, 2, 3, 4, and 5.

  • When the value of PeriodUnit is Day, the valid values are 1 to 365.

Default value: 1

1

PeriodUnit

string

No

The unit of the validity period of the elasticity assurance. Valid values:

  • Month

  • Year

  • Day

    **

    Note If you set PeriodUnit to Day, you must specify RecurrenceRules to create a time-segmented elasticity assurance.

Default value: Year.

Year

ClientToken

string

No

The client token that you want to use to ensure the idempotence of the request. You can use the client to generate the token, but you must make sure that the token is unique among different requests. The token can contain only ASCII characters and cannot exceed 64 characters in length. For more information, see How to ensure idempotence.

0c593ea1-3bea-11e9-b96b-88e9fe637760

PrivatePoolOptions.Name

string

No

The name of the elasticity assurance. The name must be 2 to 128 characters in length. It must start with a letter and cannot start with http:// or https://. It can contain letters, digits, colons (:), underscores (_), and hyphens (-).

eapTestName

Description

string

No

The description of the elasticity assurance. The description must be 2 to 256 characters in length. It cannot start with http:// or https://.

This parameter is empty by default.

This is description.

PrivatePoolOptions.MatchCriteria

string

No

The type of the private pool with which you want to associate the elasticity assurance. Valid values:

  • Open: open private pool. If you use the elasticity assurance to create ECS instances, the open private pool that is associated with the elasticity assurance is automatically matched. If no capacity is available in the open private pool, resources in the public pool are automatically used to create the ECS instances.

  • Target: targeted private pool. If you use the elasticity assurance to create ECS instances, the specified private pool that is associated with the elasticity assurance is automatically matched. If no capacity is available in the private pool, the ECS instances fail to be created.

Default value: Open.

Open

AssuranceTimes

string

No

The total number of times that the elasticity assurance can be used. Set the value to Unlimited. This value specifies that the elasticity assurance can be used for an unlimited number of times within its validity period.

Default value: Unlimited.

Unlimited

InstanceAmount

integer

No

The total number of instances of an instance type for which you want to reserve capacity.

Valid values: 1 to 1000.

Note

You must specify this parameter.

2

InstanceCpuCoreCount

integer

No

Note

This parameter is no longer used.

null

StartTime

string

No

The time when the elasticity assurance takes effect. The default value is the time when the CreateElasticityAssurance operation is called to create the elasticity assurance. Specify the time in the ISO 8601 standard in the yyyy-MM-ddTHH:mm:ssZ format. The time must be in UTC. For more information, see ISO 8601.

2020-10-30T06:32:00Z

ZoneId

array

Yes

The ID of the zone in which to create the elasticity assurance. An elasticity assurance can be used to reserve resources within a single zone.

cn-hangzhou-h

string

No

The ID of the zone in which to create the elasticity assurance. An elasticity assurance can be used to reserve resources within a single zone.

cn-hangzhou-h

InstanceType

array

Yes

The instance type. An elasticity assurance can be created to reserve the capacity of a single instance type.

ecs.c6.xlarge

string

No

The instance type. An elasticity assurance can be created to reserve the capacity of a single instance type.

ecs.c6.xlarge

RecurrenceRules

array<object>

No

The assurance schedules based on which the capacity reservation takes effect.

Note

Time-segmented elasticity assurances are available only in specific regions and to specific users. To use time-segmented elasticity assurances, submit a ticket.

object

No

The assurance schedule based on which the capacity reservation takes effect.

StartHour

integer

No

The start time of the assurance period for the capacity reservation. Specify an on-the-hour point in time.

Note

You must specify both StartHour and EndHour. EndHour must be at least four hours later than StartHour.

4

RecurrenceType

string

No

The type of the assurance schedule. Valid values:

  • Daily

  • Weekly

  • Monthly

Note

You must specify both RecurrenceType and RecurrenceValue.

Daily

EndHour

integer

No

The end time of the assurance period for the capacity reservation. Specify an on-the-hour point in time.

10

RecurrenceValue

string

No

The days of the week or month on which the capacity reservation takes effect or the interval, in number of days, at which the capacity reservation takes effect.

  • If you set RecurrenceType to Daily, you can specify only one value for this parameter. Valid values: 1 to 31. The value specifies that the capacity reservation takes effect every few days.

  • If you set RecurrenceType to Weekly, you can specify multiple values for this parameter. Separate the values with commas (,). Valid values: 0, 1, 2, 3, 4, 5, and 6, which specify Sunday, Monday, Tuesday, Wednesday, Thursday, Friday, and Saturday, respectively. Example: 1,2, which specifies that the capacity reservation takes effect on Monday and Tuesday.

  • If you set RecurrenceType to Monthly, you can specify two values in the A-B format for this parameter. Valid values of A and B: 1 to 31. B must be greater than or equal to A. For example, 1-5 indicates that the execution is repeated from the 1st to 5th of each month.

Note

You must specify both RecurrenceType and RecurrenceValue.

1

AutoRenew

boolean

No

Specifies whether to enable auto-renewal for the elasticity assurance. Valid values:

  • true

  • false

Default value: false.

true

AutoRenewPeriod

integer

No

The auto-renewal period. Unit: month. Valid values: 1, 2, 3, 6, 12, 24, and 36.

  • Default value when PeriodUnit is set to Month: 1.

  • Default value when PeriodUnit is set to Year: 12.

Note

If you set AutoRenew to true, you must specify this parameter.

1

Response elements

Element

Type

Description

Example

object

RequestId

string

The request ID.

473469C7-AA6F-4DC5-B3DB-A3DC0DE3C83E

PrivatePoolOptionsId

string

The elasticity assurance ID.

eap-bp67acfmxazb4****

OrderId

string

The order ID.

1234567890

Examples

Success response

JSON format

{
  "RequestId": "473469C7-AA6F-4DC5-B3DB-A3DC0DE3C83E",
  "PrivatePoolOptionsId": "eap-bp67acfmxazb4****",
  "OrderId": "1234567890"
}

Error codes

HTTP status code

Error code

Error message

Description

400 InvalidOperation.PeriodUnitUnsupported TimeDivisionElasticityAssurance only supports PeriodUnit of Day.
400 InvalidParameter.RegionId The specified RegionId is invalid. The specified region does not exist or is unavailable.
400 OperationDenied The specified instanceType or zone is not available or not authorized. Specified specifications or Availability Zones are not available
400 MissingParameter.RegionId The specified RegionId should not be null. The RegionId parameter is required.
400 InvalidStartTime.NotSupported The specified StartTime should be within 180 calendar days from the current date, and you must specify a precision to hour. The specified StartTime value is out of range.
400 InvalidStartTime.MalFormed The specified StartTime is out of the permitted range. The specified StartTime value exceeds the maximum allowed value.
400 Invalid.PrivatePoolOptionsName.MalFormed The specified PrivatePoolOptions.Name is not valid. The specified PrivatePoolOptions.Name is invalid
400 Invalid.ZoneId The specified ZoneId is not valid. The specified ZoneId is invalid.
400 Invalid.InstanceType The specified InstanceType is not valid. The specified InstanceType is illegal.
400 DedicatedHostNotSupported DedicatedHost is not supported for PrivatePool. The private pool does not support dedicated hosts.
400 SpotNotSupported Spot is not supported for PrivatePool. The private pool does not support spot instances.
400 ClassicNetworkNotSupported Classic network is not supported for PrivatePool. The private pool does not support instances in the classic network.
400 Invalid.InstanceId Instance does not exist. The specified instance does not exist.
400 Invalid.PrivatePoolOptions.MatchCriteria Target mode does not support this operation. The operation is not supported while the PrivatePoolOptions.MatchCriteria parameter is set to Target.
400 MissingParameter.PrivatePoolOptions.Id The specified PrivatePoolOptions.Id should not be null. The PrivatePoolOptions.Id parameter is required.
400 Invalid.PrivatePoolOptions.Id The PrivatePool does not exist. The private pool does not exist.
400 Invalid.InstanceChargeType The InstanceChargeType does not match the PrivatePool. The instance billing method and the private pool do not match.
400 Invalid.PrivatePoolOptions.status The PrivatePool status is not valid. The specified private pool state is incorrect.
400 InvalidPlatform.ValueNotSupported The Platform does not match the PrivatePool. The specified Platform parameter does not match the private pool.
400 InvalidAliUid The PrivatePool does not belong to the user of the Instance. The specified private pool does not belong to the user who attempted to create the instance.
400 MissingParameter.PackageType The specified parameter "PackageType" can not be empty.
400 MissingParameter.PrivatePoolOptions.Ids The specified parameter "PrivatePoolOptions.Ids" can not be empty. Specifies that the parameter "PrivatePoolOptions.ids" cannot be empty.
400 MissingParameter.InstanceCpuCoreCount The specified parameter "InstanceCpuCoreCount" can not be empty. The specified parameter 'InstanceCpuCocount' cannot be empty.
400 MissingParameter.InstanceAmount The specified parameter "InstanceAmount" can not be empty. The specified parameter InstanceAmount cannot be empty.
400 MissingParameter.InstanceCpuCoreCountOrInstanceAmount The specified parameter "InstanceCpuCoreCount" and "InstanceAmount" must not be empty at the same time. The specified parameter InstanceCpuCoreCount and InstanceAmount cannot be both empty.
400 Invalid.TooManyPrivatePoolOptions.Ids Too many PrivatePoolOptions.Ids in this request. The number of specified private pool IDs exceeds the upper limit.
400 Invalid.TooManyZoneIds Too many ZoneIds in the request. The number of specified zone IDs exceeds the upper limit.
400 Invalid.TooManyInstanceTypes Too many InstanceTypes in the request. The number of specified instance types exceeds the upper limit.
400 Invalid.TooManyUnpaidPrivatePool Too many PrivatePools create but still unpaid. Multiple private pools are created but not paid.
400 Invalid.InstanceCpuCoreCountOrInstanceAmount Both InstanceCpuCoreCount and InstanceAmount are provided. The InstanceCpuCoreCount and InstanceAmount parameters cannot be both specified.
400 Invalid.PrivatePoolOptions.Ids The specified parameter "PrivatePoolOptions.Ids" exist invalid element Id. The specified private pool ID does not exist.
400 Invalid.PackageType The specified parameter "PackageType" is invalid. The specified parameter PackageType is invalid.
400 Invalid.PrivatePool.Purchase The PrivatePool has already paid. The private pool is already paid.
400 Invalid.AssuranceTimes.NotSupported The value of AssuranceTimes is not supported. The specified AssuranceTimes parameter is invalid.
400 RepeatStartPrivatePool PrivatePool has already been started. The private pool is already started.
400 Invalid.PeriodUnit Only Month or Year is supported for PeriodUnit. Purchase duration unit value does not match.
400 AccountForbidden.ProductCreationLimited The commodity must be officially operated by Aliyun and in pay-as-you-go billing method.
400 RegionUnauthorized There is no authority to create private pool in the specified region.
400 PriceNotFound The price of your queried resource is not available now, please try other resources. The price of the specified resource does not exist. Modify the parameter value and try again later.
400 InvalidRecurrenceRules.CountLimitExceeded The count of RecurrenceRules exceeds the limit. The number of parameter RecurrenceRules exceeds the limit value.
400 InvalidRecurrenceRulesStartHourEndHour.TooShort The recurrence hour between RecurrenceRules.StartHour and RecurrenceRules.EndHour is too short. The effective time between parameter RecurrenceRules.StartHour and RecurrenceRules.EndHour is less than the minimum requirement.
400 InvalidParameter.RecurrenceRulesStartHourEndHour The specified parameter RecurrenceRules.StartHour or RecurrenceRules.EndHour is invalid. The parameter RecurrenceRules.StartHour or RecurrenceRules.EndHour specified for the RecurrenceRules does not conform to the specification.
400 InvalidParameter.RecurrenceRulesRecurrenceValueMonthly The specified parameter RecurrenceRules.RecurrenceValue for Monthly is invalid. The parameter RecurrenceRules.RecurrenceValue specified for the RecurrenceRules.RecurrenceType = Monthly does not conform to the specification.
400 InvalidParameter.RecurrenceRulesRecurrenceValueWeekly The specified parameter RecurrenceRules.RecurrenceValue for Weekly is invalid. The parameter RecurrenceRules.RecurrenceType specified for RecurrenceRules.RecurrenceValue = Weekly is out of specification.
400 InvalidParameter.RecurrenceRulesRecurrenceValueDaily The specified parameter RecurrenceRules.RecurrenceValue for Daily is invalid. The parameter RecurrenceRules.RecurrenceType specified for RecurrenceRules.RecurrenceValue = Daily does not conform to the specification.
400 InvalidParameter.RecurrenceRulesRecurrenceType The specified parameter RecurrenceRules.RecurrenceType is invalid. The specified parameter RecurrenceRules.RecurrenceType does not conform to specification.
400 InvalidAutoRenewPeriod.ValueNotSupported The specified autoRenewPeriod is invalid. The specified auto-renewal duration is invalid.
400 InvalidOperation.ElasticityAssuranceActiveTimeTooShort The total active time of the ElasticityAssurance is too short. The total active time of the ElasticityAssurance is too short.
500 InternalError The request processing has failed due to some unknown error, exception or failure. An internal error has occurred. Try again later.
403 Zone.NotOpen The specified zone is not granted to you to buy resources yet.
403 InvalidResourceType.NotSupported %s The specified resource combination does not exist. Change to another zone or specification.
403 OperationDenied.NoStock The resource is out of stock in the specified zone. Please try other types, or choose other regions and zones. The requested resources are unavailable in the specified zone. Try a different resource type or select a different region or zone.
403 InvalidInstanceType.NotSupported The specified InstanceType is invalid.
403 Invalid.ZoneIds At least one of the specified ZoneIds are invalid. At least one of the specified ZoneIds is invalid.
403 Zone.NotOnSale The specified zone is not available for purchase. The requested resources are unavailable in the specified zone. Try a different instance type or select a different region or zone.
403 QuotaExceed.ElasticityAssuranceCapacity ElasticityAssurance Capacity quota exceeded. ElasticityAssurance Capacity quota exceeded.
403 InvalidAccount.NotSupportEA According to business rules, this account cannot purchase ECS ElasticityAssurance. According to business rules, this account cannot purchase ECS ElasticityAssurance.
404 InvalidZoneId.NotFound The specified zoneId does not exist. The specified zone ID does not exist.
404 InvalidResourceGroup.NotFound The ResourceGroup provided does not exist in our records. The specified resource group does not exist.

See Error Codes for a complete list.

Release notes

See Release Notes for a complete list.