文档

CreateCapacityReservation - 创建容量预定服务

更新时间:

调用CreateCapacityReservation创建容量预定服务。

接口说明

您可以通过容量预定服务,指定可用区、实例规格等属性,系统会以私有池的方式预留属性相匹配的资源。更多信息,请参见立即生效容量预定概述

  • 目前服务仅支持立即生效模式。购买立即生效容量预定服务后,实例规格即开始遵循按量付费标准计费,不论是否实际创建了按量付费实例,直至您自行手动释放或到期系统自动释放立即生效容量预订。
    • 您可以通过 CreateInstanceRunInstances 创建实例时设置私有池容量选项,或者通过 ModifyInstanceAttachmentAttributes 修改实例的私有池容量选项。实例成功匹配私有池容量后,将根据您的实例配置收取实例规格、云盘、公网带宽等相关资源费用。
    • 未实际创建按量付费实例时,仅收取实例规格的费用。
  • 立即生效容量预定的匹配的实例和未使用的容量账单支持通过节省计划、地域级预留实例券抵扣小时账单,不支持通过可用区级预留实例券抵扣小时账单。推荐您先购买预留实例券或节省计划,在预留实例券或节省计划的覆盖下使用立即生效容量预定服务,可以免费获取资源的确定性保障。
说明 调用 API 方式仅支持创建立即生效容量预定。通过 ECS 控制台可以创建立即生效容量预定或指定时间生效容量预定,更多信息,请参见资源预定服务

调试

您可以在OpenAPI Explorer中直接运行该接口,免去您计算签名的困扰。运行成功后,OpenAPI Explorer可以自动生成SDK代码示例。

授权信息

下表是API对应的授权信息,可以在RAM权限策略语句的Action元素中使用,用来给RAM用户或RAM角色授予调用此API的权限。具体说明如下:

  • 操作:是指具体的权限点。
  • 访问级别:是指每个操作的访问级别,取值为写入(Write)、读取(Read)或列出(List)。
  • 资源类型:是指操作中支持授权的资源类型。具体说明如下:
    • 对于必选的资源类型,用背景高亮的方式表示。
    • 对于不支持资源级授权的操作,用全部资源表示。
  • 条件关键字:是指云产品自身定义的条件关键字。
  • 关联操作:是指成功执行操作所需要的其他权限。操作者必须同时具备关联操作的权限,操作才能成功。
操作访问级别资源类型条件关键字关联操作
ecs:CreateCapacityReservationWrite
  • CapacityReservation
    acs:ecs:{#regionId}:{#accountId}:capacityreservation/*

请求参数

名称类型必填描述示例值
RegionIdstring

容量预定服务所属地域 ID。您可以调用 DescribeRegions 查看最新的阿里云地域列表。

cn-hangzhou
ResourceGroupIdstring

容量预定服务所在的企业资源组 ID。

rg-bp67acfmxazb4p****
Tagobject []

标签列表

Keystring

容量预定服务的标签键。N 的取值范围:1~20。一旦传入该值,则不允许为空字符串。最多支持 128 个字符,不能以aliyunacs:开头,不能包含http://或者https://

TestKey
Valuestring

容量预定服务的标签值。N 的取值范围:1~20。一旦传入该值,允许为空字符串。最多支持 128 个字符,不能以acs:开头,不能包含http://或者https://

TestValue
ClientTokenstring

保证请求幂等性。从您的客户端生成一个参数值,确保不同请求间该参数值唯一。ClientToken只支持 ASCII 字符,且不能超过 64 个字符。更多信息,请参见如何保证幂等性

0c593ea1-3bea-11e9-b96b-88e9fe637760
PrivatePoolOptions.Namestring

容量预定服务的名称。长度为 2~128 个英文或中文字符。必须以大小写字母或中文开头,不能以http://https://开头。可以包含数字、半角冒号(:)、下划线(_)或者短划线(-)。

crpTestName
Descriptionstring

容量预定服务的描述信息。长度为 2~256 个英文或中文字符,不能以http://https://开头。

默认值:空

This is description.
PrivatePoolOptions.MatchCriteriastring

容量预定服务生效后生成的私有资源池的类型。取值范围:

  • Open:开放模式。
  • Target:专用模式。

默认值:Open

Open
InstanceAmountinteger

在一个实例规格内,需要预留的实例的总数量。

2
InstanceTypestring

实例规格。目前仅支持为一个实例规格设置容量预定服务。您可以调用 DescribeInstanceTypes 查询云服务器 ECS 提供的实例规格信息。

ecs.g6.xlarge
StartTimestring

容量预定服务的生效方式。目前调用 API 的方式仅支持设置为立即生效。

说明 该参数不传值即表示设置为立即生效。
2021-10-30T05:32:00Z
EndTimestring

容量预定服务的失效时间。时间格式以 ISO8601 为标准,并需要使用 UTC +0 时间,格式为yyyy-MM-ddTHH:mm:ssZ。更多信息,请参见ISO 8601

2021-10-30T06:32:00Z
EndTimeTypestring

容量预定服务的失效方式。取值范围:

  • Limited:指定时间释放。必须同时指定EndTime参数。
  • Unlimited:手动释放。不限制时间。
Unlimited
Platformstring

实例使用的镜像的操作系统类型。该参数与地域级预留实例券的Platform参数对应。如果容量预定服务和地域级预留实例券的操作系统类型相匹配,则可以使用地域级预留实例券来抵扣容量预定服务中的未使用容量的账单。取值范围:

  • Windows:Windows Server 类型的操作系统。
  • Linux:Linux 及类 Unix 类型的操作系统。

默认值:Linux

说明 该参数暂未开放使用。
Linux
ZoneIdarray

容量预定服务所属地域下的可用区 ID。目前仅支持在一个可用区下创建容量预定服务。

string

容量预定服务所属地域下的可用区 ID。目前仅支持在一个可用区下创建容量预定服务。

cn-hangzhou-h

返回参数

名称类型描述示例值
object
PrivatePoolOptionsIdstring

容量预定服务 ID。

crp-bp67acfmxazb4****
RequestIdstring

请求 ID。

473469C7-AA6F-4DC5-B3DB-A3DC0DE3C83E

示例

正常返回示例

JSON格式

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

错误码

HTTP status code错误码错误信息描述
400NoStockIt has not enough stock in the iz.-
400MissingParameterThe input parameter StartTime is missing.-
400OperationDeniedThe specified InstanceType or Zone is not available or not authorized.指定的实例规格或可用区不可用或者未授权。
400MissingParameter.RegionIdThe specified RegionId should not be null.RegionId是必选参数。
400InvalidStartTime.NotSupportedThe specified StartTime should be within 180 calendar days from the current date, and you must specify a precision to hour.指定的 StartTime 参数不在有效取值范围内。
400InvalidStartTime.MalFormedThe specified StartTime is out of the permitted range.指定的 StartTime 参数超出了最大有效取值。
400Invalid.PrivatePoolOptionsName.MalFormedThe specified PrivatePoolOptions.Name is not valid.-
400Invalid.ZoneIdThe specified ZoneId is not valid.-
400Invalid.InstanceTypeThe specified InstanceType is not valid.-
400DedicatedHostNotSupportedDedicatedHost is not supported for PrivatePool.私有池不支持专有宿主机。
400SpotNotSupportedSpot is not supported for PrivatePool.私有池不支持抢占式实例。
400ClassicNetworkNotSupportedClassic network is not supported for PrivatePool.私有池不支持经典网络类型实例。
400Invalid.InstanceIdInstance does not exist.实例不存在。
400Invalid.PrivatePoolOptions.MatchCriteriaTarget mode does not support this operation.Target模式不支持本次操作。
400MissingParameter.PrivatePoolOptions.IdThe specified PrivatePoolOptions.Id should not be null.PrivatePoolOptions.Id 参数不能为空。
400Invalid.PrivatePoolOptions.IdThe PrivatePool does not exist.私有池不存在。
400Invalid.InstanceTypeThe InstanceType does not match the PrivatePool.实例类型与私有池不匹配。
400Invalid.InstanceChargeTypeThe InstanceChargeType does not match the PrivatePool.实例计费类型与私有池不匹配。
400Invalid.ZoneIdThe ZoneId does not match the PrivatePool.可用区与私有池不匹配。
400Invalid.PrivatePoolOptions.statusThe PrivatePool has been used up.-
400Invalid.PrivatePoolOptions.MatchCriteriaThe PrivatePoolOptions.MatchCriteria does not match the PrivatePool.指定的PrivatePoolOptions.MatchCriteria参数与私有池不匹配。
400InvalidPlatform.ValueNotSupportedThe Platform does not match the PrivatePool.指定的Platform参数与私有池不匹配。
400Invalid.PrivatePoolOptions.statusThe PrivatePool is expired or inactive.-
400Invalid.PrivatePoolOptions.statusThe PrivatePool status is not valid.-
400Invalid.PrivatePoolOptions.statusThe Instance should be created within 48 hours once the PrivatePool is started.-
400InvalidAliUidThe PrivatePool does not belong to the user of the Instance.私有池不属于创建实例的用户。
400Invalid.InstanceIdThe Instance dose not attached to a PrivatePool.实例未与私有池匹配。
400MissingParameter.PackageTypeThe specified parameter "PackageType" can not be empty.-
400MissingParameter.PrivatePoolOptions.IdsThe specified parameter "PrivatePoolOptions.Ids" can not be empty.-
400MissingParameter.PrivatePoolOptions.IdThe specified parameter "PrivatePoolOptions.Id" can not be empty.-
400MissingParameter.InstanceCpuCoreCountThe specified parameter "InstanceCpuCoreCount" can not be empty.-
400MissingParameter.InstanceAmountThe specified parameter "InstanceAmount" can not be empty.-
400MissingParameter.InstanceCpuCoreCountOrInstanceAmountThe specified parameter "InstanceCpuCoreCount" and "InstanceAmount" must not be empty at the same time.-
400Invalid.TooManyPrivatePoolOptions.IdsToo many PrivatePoolOptions.Ids in this request.PrivatePoolOptions.Ids参数超过上限。
400Invalid.TooManyZoneIdsToo many ZoneIds in the request.ZoneIds参数超过上限。
400Invalid.TooManyInstanceTypesToo many InstanceTypes in the request.InstanceTypes参数超过上限。
400Invalid.TooManyUnpaidPrivatePoolToo many PrivatePools create but still unpaid.多个私有池未支付。
400Invalid.InstanceCpuCoreCountOrInstanceAmountBoth InstanceCpuCoreCount and InstanceAmount are provided.InstanceCpuCoreCount和InstanceAmount两个参数不需要同时提供。
400Invalid.PrivatePoolOptions.IdsThe specified parameter "PrivatePoolOptions.Ids" exist invalid element Id.-
400Invalid.PackageTypeThe specified parameter "PackageType" is invalid.-
400Invalid.PrivatePool.PurchaseThe PrivatePool has already paid.私有池已经支付。
400Invalid.AssuranceTimes.NotSupportedThe value of AssuranceTimes is not supported.AssuranceTimes参数值不支持。
400Invalid.TooManyInstanceTypesThe specified parameter "InstanceType" should only has one item.-
400Invalid.PrivatePoolOptions.MatchCriteriaThe specified parameter "PrivatePoolOptions.MatchCriteria" is invalid.-
400RepeatStartPrivatePoolPrivatePool has already been started.私有池已经启动。
400Invalid.PrivatePoolOptions.IdThe specified parameter "PrivatePoolOptions.Id" should be empty.-
400Invalid.InstanceIdModify DedicatedHost Instance's attachment attributes is not supported.-
400Invalid.InstanceIdModify Spot Instance's attachment attributes is not supported.-
400Invalid.InstanceIdModify Classic Network Instance's attachment attributes is not supported.-
400Invalid.TimeSlotThe param time slot is invalid.-
400Invalid.EndTimeThe specified parameter "EndTime" is not valid.-
400StartTime.NotNeedThe specified parameter "StartTime" should leave empty.-
400AccountForbidden.ProductCreationLimitedThe commodity must be officially operated by Aliyun and in pay-as-you-go billing method.集团上云客户只能购买按量付费的 ECS,且不能购买第三方的商品比如由镜像市场提供的镜像。请检查参数,传入符合条件的参数重试。
400RegionUnauthorizedThere is no authority to create private pool in the specified region.-
400PriceNotFoundThe price of your queried resource is not available now, please try other resources.未找到价格,请修改相应的参数值重试。
403Zone.NotOpenThe specified zone is not granted to you to buy resources yet.用户未被授权购买指定的可用区的资源。
403InvalidResourceType.NotSupported%s-
403OperationDenied.NoStockThe resource is out of stock in the specified zone. Please try other types, or choose other regions and zones.指定的资源在指定可用区中无货。请尝试其他类型,或选择其他可用区和地域。
403InvalidInstanceType.NotSupportedThe specified InstanceType is invalid.指定的参数“InstanceType”无效。
403Invalid.ZoneIdsAt least one of the specified ZoneIds are invalid.-
403Zone.NotOnSaleThe specified zone is not available for purchase.指定可用区已经售罄,请您更换实例规格或者更换地域创建。
404InvalidZoneId.NotFoundThe specified zoneId does not exist.指定的可用区 ID 不存在。
404InvalidResourceGroup.NotFoundThe ResourceGroup provided does not exist in our records.资源组并不在记录中。
500InternalErrorThe request processing has failed due to some unknown error, exception or failure.内部错误,请重试。
500InternalErrorThe request processing has failed due to some unknown error.内部错误,请重试。

访问错误中心查看更多错误码。

变更历史

变更时间变更内容概要操作
2021-07-29OpenAPI 错误码发生变更看变更集
变更项变更内容
错误码OpenAPI 错误码发生变更
    错误码 400 变更
    删除错误码:403
    删除错误码:404
    删除错误码:500
  • 本页导读 (1)
文档反馈