全部產品
Search
文件中心

Elastic Compute Service:CreateElasticityAssurance - 建立彈性保障服務

更新時間:Apr 04, 2026

通過指定彈性保障服務所屬地區下的可用性區域、執行個體規格、購買時間長度、是否自動續約等參數建立彈性保障服務。

介面說明

彈性保障服務為您提供了兼顧靈活性和確定性全新的資源購買和使用方式,是一種能夠為隨用隨付的 ECS 執行個體提供確定性保障的資源預定服務。更多資訊,請參見彈性保障概述

  • 購買彈性保障服務後,普通彈性保障服務支援退款,分時彈性保障服務不支援退款。計費請參見資源保障

  • 通過彈性保障服務只能建立計費方式為隨用隨付的 ECS 執行個體。

  • 目前彈性保障次數只開放了無限次的模式,即AssuranceTimes參數只支援設定為Unlimited。無限次模式的彈性保障服務在保障生效後,將自動啟動。

調試

您可以在OpenAPI Explorer中直接運行該介面,免去您計算簽名的困擾。運行成功後,OpenAPI Explorer可以自動產生SDK程式碼範例。

調試

授權資訊

下表是API對應的授權資訊,可以在RAM權限原則語句的Action元素中使用,用來給RAM使用者或RAM角色授予調用此API的許可權。具體說明如下:

  • 操作:是指具體的許可權點。

  • 存取層級:是指每個操作的存取層級,取值為寫入(Write)、讀取(Read)或列出(List)。

  • 資源類型:是指操作中支援授權的資源類型。具體說明如下:

    • 對於必選的資源類型,用前面加 * 表示。

    • 對於不支援資源級授權的操作,用全部資源表示。

  • 條件關鍵字:是指雲產品自身定義的條件關鍵字。

  • 關聯操作:是指成功執行操作所需要的其他許可權。操作者必須同時具備關聯操作的許可權,操作才能成功。

操作

存取層級

資源類型

條件關鍵字

關聯操作

ecs:CreateElasticityAssurance

create

*ElasticityAssurance

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

請求參數

名稱

類型

必填

描述

樣本值

RegionId

string

彈性保障服務所屬地區 ID。您可以調用 DescribeRegions 查看最新的阿里雲地區列表。

cn-hangzhou

ResourceGroupId

string

彈性保障服務所在的企業資源組 ID。

rg-bp67acfmxazb4p****

Tag

array<object>

彈性保障服務的標籤列表。

object

標籤對資訊。

Value

string

彈性保障服務的標籤值。N 的取值範圍:1~20。一旦傳入該值,允許為空白字串。最多支援 128 個字元,不能以acs:開頭,不能包含http://或者https://

TestValue

Key

string

彈性保障服務的標籤鍵。N 的取值範圍:1~20。一旦傳入該值,則不允許為空白字串。最多支援 128 個字元,不能以aliyunacs:開頭,不能包含http://或者https://

TestKey

Period

integer

購買時間長度。時間長度單位由PeriodUnit參數確定。取值範圍:

  • PeriodUnit參數值為Month時,該參數的取值:1、2、3、4、5、6、7、8、9。

  • PeriodUnit參數值為Year時,該參數的取值:1、2、3、4、5。

  • PeriodUnit參數值為Day時,該參數的取值:1~365。

預設值:1。

1

PeriodUnit

string

時間長度單位。取值範圍:

  • Month:月

  • Year:年

  • Day:天
    說明

    PeriodUnit取值為Day時,必須同時指定 RecurrenceRules,表示建立彈性保障-分時保障。

預設值:Year。

Year

ClientToken

string

保證請求等冪性。從您的用戶端產生一個參數值,確保不同請求間該參數值唯一。ClientToken只支援 ASCII 字元,且不能超過 64 個字元。更多資訊,請參見如何保證等冪性

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

PrivatePoolOptions.Name

string

彈性保障服務的名稱。長度為 2~128 個英文或中文字元。必須以大小寫字母或中文開頭,不能以http://https://開頭。可以包含數字、半形冒號(:)、底線(_)或者連字號(-)。

eapTestName

Description

string

彈性保障服務的描述資訊。長度為 2~256 個英文或中文字元,不能以http://https://開頭。

預設值:空。

This is description.

PrivatePoolOptions.MatchCriteria

string

彈性保障服務的匹配模式。取值範圍:

  • Open:開放模式的彈性保障服務。執行個體啟動時將自動匹配開放類型的私人池容量。如果沒有合格私人池容量,則使用公用池資源啟動。

  • Target:指定模式的彈性保障服務。執行個體啟動時將使用指定的私人池容量,如果該私人池容量不可用,則執行個體會啟動失敗。

預設值:Open。

Open

AssuranceTimes

string

彈性保障的總次數。取值:Unlimited,目前僅支援在服務生效期內的無限次模式。

預設值:Unlimited。

Unlimited

InstanceAmount

integer

在一個執行個體規格內,需要預留的執行個體的總數量。

取值範圍:1~1000。

重要 此參數為必填參數。

2

InstanceCpuCoreCount

integer

說明

該參數已廢棄。

null

StartTime

string

彈性保障服務生效時間。預設為調用該介面建立服務的時間。時間格式以 ISO 8601 為標準,需要使用 UTC +0 時間,格式為yyyy-MM-ddTHH:mm:ssZ。更多資訊,請參見ISO 8601

2020-10-30T06:32:00Z

ZoneId

array

彈性保障服務所屬地區下的可用性區域 ID。目前僅支援在一個可用性區域下建立彈性保障服務。

cn-hangzhou-h

string

彈性保障服務所屬地區下的可用性區域 ID。

cn-hangzhou-h

InstanceType

array

執行個體規格。目前僅支援為一個執行個體規格設定彈性保障服務。

ecs.c6.xlarge

string

執行個體規格。

ecs.c6.xlarge

RecurrenceRules

array<object>

彈性保障-分時保障重複規則列表。

object

彈性保障-分時保障重複規則。

StartHour

integer

分時保障生效時間,取值必須為整點。

說明

同時指定StartHourEndHour,且兩者至少需要相差 4 小時。

4

RecurrenceType

string

重複規則的策略類型。取值範圍:

  • Daily:按天重複。

  • Weekly:按周重複。

  • Monthly:按月重複。

說明

必須同時指定RecurrenceTypeRecurrenceValue

Daily

EndHour

integer

分時保障結束時間,取值必須為整點。

10

RecurrenceValue

string

重複規則執行數值。

  • RecurrenceTypeDaily時,只能填一個值,取值範圍:1~31。表示每幾天執行一次。

  • RecurrenceTypeWeekly時,可以填入多個值,多個值間使用半形逗號(,)隔開。周日、周一、周二、周三、周四、周五、周六的值依次為:0,1,2,3,4,5,6。例如1,2表示周一和周二執行。

  • RecurrenceTypeMonthly時,格式為A-B。A、B 的取值範圍為 1~31,並且 B 必須大於等於 A。例如:1-5表示每月的 1~5 日重複執行。

說明

必須同時指定RecurrenceTypeRecurrenceValue

1

AutoRenew

boolean

是否自動續約。取值範圍:

  • true:自動續約。

  • false:不自動續約。

預設值:false。

true

AutoRenewPeriod

integer

自動續約的時間長度,單位:月。取值範圍:1、2、3、6、12、24、36。

  • PeriodUnit=Month時,預設值為 1;

  • PeriodUnit=Year時,預設值為 12。

說明

當參數AutoRenew取值True時,該參數為必填參數。

1

返回參數

名稱

類型

描述

樣本值

object

RequestId

string

請求 ID。

473469C7-AA6F-4DC5-B3DB-A3DC0DE3C83E

PrivatePoolOptionsId

string

彈性保障服務 ID。

eap-bp67acfmxazb4****

OrderId

string

產生的訂單 ID。

1234567890

樣本

正常返回樣本

JSON格式

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

錯誤碼

HTTP status code

錯誤碼

錯誤資訊

描述

400 InvalidOperation.PeriodUnitUnsupported TimeDivisionElasticityAssurance only supports PeriodUnit of Day.
400 InvalidParameter.RegionId The specified RegionId is invalid. 指定的地區不存在或不可用。
400 OperationDenied The specified instanceType or zone is not available or not authorized. 指定的規格或可用性區域不可用
400 MissingParameter.RegionId The specified RegionId should not be null. RegionId是必選參數。
400 InvalidStartTime.NotSupported The specified StartTime should be within 180 calendar days from the current date, and you must specify a precision to hour. 指定的 StartTime 參數不在有效取值範圍內。
400 InvalidStartTime.MalFormed The specified StartTime is out of the permitted range. 指定的 StartTime 參數超出了最大有效取值。
400 Invalid.PrivatePoolOptionsName.MalFormed The specified PrivatePoolOptions.Name is not valid. 指定的PrivatePoolOptions.Name無效
400 Invalid.ZoneId The specified ZoneId is not valid. 指定的ZoneId不合法
400 Invalid.InstanceType The specified InstanceType is not valid. 指定的InstanceType不合法。
400 DedicatedHostNotSupported DedicatedHost is not supported for PrivatePool. 私人池不支援Dedicated Host。
400 SpotNotSupported Spot is not supported for PrivatePool. 私人池不支援搶佔式執行個體。
400 ClassicNetworkNotSupported Classic network is not supported for PrivatePool. 私人池不支援傳統網路類型執行個體。
400 Invalid.InstanceId Instance does not exist. 執行個體不存在。
400 Invalid.PrivatePoolOptions.MatchCriteria Target mode does not support this operation. Target模式不支援本次操作。
400 MissingParameter.PrivatePoolOptions.Id The specified PrivatePoolOptions.Id should not be null. PrivatePoolOptions.Id 參數不可為空。
400 Invalid.PrivatePoolOptions.Id The PrivatePool does not exist. 私人池不存在。
400 Invalid.InstanceChargeType The InstanceChargeType does not match the PrivatePool. 執行個體計費類型與私人池不匹配。
400 Invalid.PrivatePoolOptions.status The PrivatePool status is not valid. 指定的私人池狀態不正確。
400 InvalidPlatform.ValueNotSupported The Platform does not match the PrivatePool. 指定的Platform參數與私人池不匹配。
400 InvalidAliUid The PrivatePool does not belong to the user of the Instance. 私人池不屬於建立執行個體的使用者。
400 MissingParameter.PackageType The specified parameter "PackageType" can not be empty. 指定的參數PackageType不可為空。
400 MissingParameter.PrivatePoolOptions.Ids The specified parameter "PrivatePoolOptions.Ids" can not be empty. 指定參數“PrivatePoolOptions.ids”不可為空。
400 MissingParameter.InstanceCpuCoreCount The specified parameter "InstanceCpuCoreCount" can not be empty. 指定的參數 'InstanceCpuCocount'不可為空。
400 MissingParameter.InstanceAmount The specified parameter "InstanceAmount" can not be empty. 指定的參數InstanceAmount不可為空。
400 MissingParameter.InstanceCpuCoreCountOrInstanceAmount The specified parameter "InstanceCpuCoreCount" and "InstanceAmount" must not be empty at the same time. 指定的參數InstanceCpuCoreCount和InstanceAmount不能同時為空白。
400 Invalid.TooManyPrivatePoolOptions.Ids Too many PrivatePoolOptions.Ids in this request. PrivatePoolOptions.Ids參數超過上限。
400 Invalid.TooManyZoneIds Too many ZoneIds in the request. ZoneIds參數超過上限。
400 Invalid.TooManyInstanceTypes Too many InstanceTypes in the request. InstanceTypes參數超過上限。
400 Invalid.TooManyUnpaidPrivatePool Too many PrivatePools create but still unpaid. 多個私人池未支付。
400 Invalid.InstanceCpuCoreCountOrInstanceAmount Both InstanceCpuCoreCount and InstanceAmount are provided. InstanceCpuCoreCount和InstanceAmount兩個參數不需要同時提供。
400 Invalid.PrivatePoolOptions.Ids The specified parameter "PrivatePoolOptions.Ids" exist invalid element Id. 指定的私人池ID不存在。
400 Invalid.PackageType The specified parameter "PackageType" is invalid. 指定的參數“PackageType”無效。
400 Invalid.PrivatePool.Purchase The PrivatePool has already paid. 私人池已經支付。
400 Invalid.AssuranceTimes.NotSupported The value of AssuranceTimes is not supported. AssuranceTimes參數值不支援。
400 RepeatStartPrivatePool PrivatePool has already been started. 私人池已經啟動。
400 Invalid.PeriodUnit Only Month or Year is supported for PeriodUnit. 購買時間長度單位值不匹配。
400 AccountForbidden.ProductCreationLimited The commodity must be officially operated by Aliyun and in pay-as-you-go billing method. 集團上雲客戶只能購買隨用隨付的 ECS,且不能購買第三方的商品比如由鏡像市場提供的鏡像。請檢查參數,傳入合格參數重試。
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. 未找到價格,請修改相應的參數值重試。
400 InvalidRecurrenceRules.CountLimitExceeded The count of RecurrenceRules exceeds the limit. 參數RecurrenceRules的個數超過限定值。
400 InvalidRecurrenceRulesStartHourEndHour.TooShort The recurrence hour between RecurrenceRules.StartHour and RecurrenceRules.EndHour is too short. 參數RecurrenceRules.StartHour和RecurrenceRules.EndHour之間的生效時間小於最小要求。
400 InvalidParameter.RecurrenceRulesStartHourEndHour The specified parameter RecurrenceRules.StartHour or RecurrenceRules.EndHour is invalid. 為RecurrenceRules指定的參數RecurrenceRules.StartHour或RecurrenceRules.EndHour不符合規範。
400 InvalidParameter.RecurrenceRulesRecurrenceValueMonthly The specified parameter RecurrenceRules.RecurrenceValue for Monthly is invalid. 為RecurrenceRules.RecurrenceType=Monthly指定的參數RecurrenceRules.RecurrenceValue不符合規範。
400 InvalidParameter.RecurrenceRulesRecurrenceValueWeekly The specified parameter RecurrenceRules.RecurrenceValue for Weekly is invalid. 為RecurrenceRules.RecurrenceType=Weekly指定的參數RecurrenceRules.RecurrenceValue不符合規範。
400 InvalidParameter.RecurrenceRulesRecurrenceValueDaily The specified parameter RecurrenceRules.RecurrenceValue for Daily is invalid. 為RecurrenceRules.RecurrenceType=Daily指定的參數RecurrenceRules.RecurrenceValue不符合規範。
400 InvalidParameter.RecurrenceRulesRecurrenceType The specified parameter RecurrenceRules.RecurrenceType is invalid. 指定的參數RecurrenceRules.RecurrenceType不符合規範。
400 InvalidAutoRenewPeriod.ValueNotSupported The specified autoRenewPeriod is invalid. 指定的自動續約時間長度無效。
400 InvalidOperation.ElasticityAssuranceActiveTimeTooShort 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. 內部錯誤,請重試。
403 Zone.NotOpen The specified zone is not granted to you to buy resources yet.
403 InvalidResourceType.NotSupported %s 指定資源群組合不存在,請更換其他可用性區域或規格
403 OperationDenied.NoStock The resource is out of stock in the specified zone. Please try other types, or choose other regions and zones. 指定的資源在指定可用性區域中無貨。請嘗試其他類型,或選擇其他可用性區域和地區。
403 InvalidInstanceType.NotSupported The specified InstanceType is invalid.
403 Invalid.ZoneIds At least one of the specified ZoneIds are invalid. 指定的ZoneIds中至少有一個無效。
403 Zone.NotOnSale The specified zone is not available for purchase. 指定可用性區域已經售罄,請您更換執行個體規格或者更換地區建立。
403 QuotaExceed.ElasticityAssuranceCapacity ElasticityAssurance Capacity quota exceeded. 彈性保障服務容量配額超出限制。
403 InvalidAccount.NotSupportEA According to business rules, this account cannot purchase ECS ElasticityAssurance. 根據商務規則,此帳號不能購買ECS彈性保障服務。
404 InvalidZoneId.NotFound The specified zoneId does not exist. 指定的可用性區域 ID 不存在。
404 InvalidResourceGroup.NotFound The ResourceGroup provided does not exist in our records. 資源群組並不在記錄中。

訪問錯誤中心查看更多錯誤碼。

變更歷史

更多資訊,參考變更詳情