本接口的主要功能是通过修改实例规格、数量、可用区等预留实例券的配置来对预留实例券进行拆分、合并或范围变更操作。
接口说明
本接口为异步接口,接口调用成功后会返回新产生的预留实例券 ID,原来的预留实例券会进入更新中状态,最终变为失效状态,与此同时,会有一张创建中状态的预留实例券产生,最终变为已生效状态,您可以通过 DescribeReservedInstances 进行查询。
预留实例券只有在已生效状态下才可以修改配置。
请确保修改配置前后预留实例券的计算力不会改变,否则修改请求会失败。
预留实例券的拆分、合并、范围变更不能同时进行。
更多信息,请参见拆分、合并或修改预留实例券。
请求示例
拆分:将一张杭州地域、实例规格为 ecs.g5.xlarge、匹配数量为 2 的预留实例券拆分为两张实例规格为 ecs.g5.large、匹配数量为 1 的预留实例券。
"RegionId":"cn-hangzhou", //设置地域为杭州
"ReservedInstanceId":["ecsri-bp1hd03e9uv19e75****"], //需要拆分的预留实例券 ID
"Configuration":[
{
"ReservedInstanceName":"testReservedInstanceName1", //修改后的预留实例券名称
"InstanceType":"ecs.g5.large", //设置修改后的实例规格
"Scope":"Region", //预留实例券的范围不可改变
"InstanceAmount":1 //表示预留实例券可以同时匹配同规格按量付费实例的数量为 1 台
},
{
"ReservedInstanceName":"testReservedInstanceName2",
"InstanceType":"ecs.g5.large",
"Scope":"Region",
"InstanceAmount":1
}
]
合并:将两张杭州地域可用区 H 、实例规格为 ecs.g5.xlarge、匹配数量为 4 的预留实例券合并为一张实例规格为 ecs.g5.4xlarge、匹配数量为 2 的预留实例券。
"RegionId":"cn-hangzhou", //设置地域为杭州
"ReservedInstanceId":["ecsri-bp1hd03e9uv16b75****",""ecsri-bp1hd03e9uv16b76****""], //需要合并的预留实例券 ID
"Configuration":[
{
"ReservedInstanceName":"testReservedInstanceName", //修改后的预留实例券名称
"InstanceType":"ecs.g5.4xlarge", //设置修改后的实例规格
"Scope":"Zone", //预留实例券的范围不可改变
"ZoneId":"cn-hangzhou-h", //
"InstanceAmount":2 //表示预留实例券可以同时匹配同规格按量付费实例的数量为 2 台
}
]
变更范围:将一张杭州地域可用区 H 、实例规格为 ecs.g5.xlarge、匹配数量为 6 的预留实例券变更为一张杭州地域、实例规格为 ecs.g5.2xlarge、匹配数量为 3 的预留实例券。
"RegionId":"cn-hangzhou", //设置地域为杭州
"ReservedInstanceId":["ecsri-bp1hd03e9uv16b77****"], //需要变更范围的预留实例券 ID
"Configuration":[
{
"ReservedInstanceName":"testReservedInstanceName", //变更范围后的预留实例券名称
"InstanceType":"ecs.g5.2xlarge", //设置修改后的实例规格
"Scope":"Region", //变更后预留实例券的范围
"InstanceAmount":3 //表示预留实例券可以同时匹配同规格按量付费实例的数量为 3 台
}
]
调试
您可以在OpenAPI Explorer中直接运行该接口,免去您计算签名的困扰。运行成功后,OpenAPI Explorer可以自动生成SDK代码示例。
调试
授权信息
|
操作 |
访问级别 |
资源类型 |
条件关键字 |
关联操作 |
|
ecs:ModifyReservedInstances |
update |
*ReservedInstance
|
无 | 无 |
请求参数
|
名称 |
类型 |
必填 |
描述 |
示例值 |
| RegionId |
string |
是 |
预留实例券所属的地域 ID。 您可以调用 DescribeRegions 获取最新的阿里云地域列表。 |
cn-hangzhou |
| ReservedInstanceId |
array |
是 |
预留实例券 ID 数组。数组长度:1~20。 |
ReservedInstanceId.1="ecsri-bp1cx3****",ReservedInstanceId.2="ecsri-bp15xx2****"...... |
|
string |
否 |
预留实例券 ID。 |
ecsri-bp15xx2**** |
|
| Configuration |
array<object> |
否 |
预留实例券的配置信息数组。数组长度:1~100。 |
|
|
object |
否 |
预留实例券的配置信息。 |
||
| ReservedInstanceName |
string |
否 |
预留实例券的名称。 长度为 2~128 个英文或中文字符。必须以大小写字母或中文开头,不能以 http://和 https://开头。可以包含数字、半角冒号(:)、下划线(_)或者短划线(-)。 |
testReservedInstanceName |
| ZoneId |
string |
否 |
预留实例券所属的可用区编号。
您可以调用 DescribeZones 获取可用区列表。 |
cn-hangzhou-i |
| Scope |
string |
是 |
预留实例券的范围。取值范围:
默认值:Region。 |
Zone |
| InstanceType |
string |
是 |
预留实例券可以匹配的实例规格。 说明
适用的实例规格持续更新,详情请参见预留实例券概述。 |
ecs.c5.4xlarge |
| InstanceAmount |
integer |
是 |
预留实例券可以同时匹配同规格按量付费实例的数量。取值范围:≥1。 |
1 |
返回参数
|
名称 |
类型 |
描述 |
示例值 |
|
object |
|||
| RequestId |
string |
请求 ID。 |
ED9E4A5F-FF4D-4C96-BE80-6B4227060DD7 |
| ReservedInstanceIdSets |
object |
||
| ReservedInstanceId |
array |
预留实例券 ID 列表。 |
|
|
string |
预留实例券 ID。 |
"ecsri-bp1cx3****" |
示例
正常返回示例
JSON格式
{
"RequestId": "ED9E4A5F-FF4D-4C96-BE80-6B4227060DD7",
"ReservedInstanceIdSets": {
"ReservedInstanceId": [
"\"ecsri-bp1cx3****\""
]
}
}
错误码
|
HTTP status code |
错误码 |
错误信息 |
描述 |
|---|---|---|---|
| 400 | InvalidInstanceType.ValueUnauthorized | The specified InstanceType is not authorized. | |
| 400 | InvalidParameter.Conflict | The specified region and cluster do not match. | 指定的地域与指定的集群不匹配。 |
| 400 | InvalidTagKey.Malformed | The specified Tag.n.Key is not valid. | 指定的标签键参数有误。 |
| 400 | InvalidPeriodUnit.ValueNotSupported | The specified parameter PeriodUnit is not valid. | 参数 PeriodUnit 无效。 |
| 400 | InvalidTagValue.Malformed | The specified Tag.n.Value is not valid. | 指定的标签值参数有误。 |
| 400 | InvalidChargeType.ValueNotSupported | ChargeType is not valid. | |
| 400 | OperationDenied | The specified InstanceType or Zone is not authorized for current user. | |
| 500 | InternalError | The request processing has failed due to some unknown error. | |
| 403 | OperationDenied.NoStock | The requested resource is sold out in the specified zone; try other types of resources or other regions and zones. | 库存不足。 |
| 403 | OperationDenied | Sales of this resource are temporarily suspended in the specified region; please try again later. | 指定的地域暂时关闭了此资源的售卖,请稍后重试。 |
| 403 | NodeControllerUnavailable | The Node Controller is temporarily unavailable. | |
| 403 | InvalidParameter.ResourceOwnerAccount | ResourceOwnerAccount is Invalid. | 指定的 ResourceOwnerAccount 不合法。 |
| 403 | Zone.NotOpen | The specified zone is not granted to you to buy resources yet. | |
| 403 | Zone.NotOnSale | The specified zone is not available for purchase. | 指定可用区已经售罄,请您更换实例规格或者更换地域创建。 |
| 403 | Account.Arrearage | Your account has been in arrears. | |
| 403 | InvalidReservedInstanceName.Malformed | The specified parameter ReservedInstanceName is invalid. | |
| 403 | InvalidParameter.Scope | The specified parameter 'Scope' is invalid. | |
| 403 | InvalidReservedInstanceStatus.ValueNotSupported | ReservedInstance status is not supported. | |
| 403 | InvalidReservedInstanceOfferingType.ValueNotSupported | The OfferingType is not supported. | |
| 403 | InvalidReservedInstanceOfferingClass.ValueNotSupported | The OfferingClass is not supported. | |
| 403 | MissingParameter.ZoneId | The specified zoneId should be not empty. | |
| 403 | MissingParameter.InstanceType | The instanceType should be not empty. | |
| 403 | MissingParameter.ReservedInstanceId | The ids of reservedInstance can not be empty. | |
| 403 | MissingParameter.ReservedInstanceConfiguration | The configurations of reservedInstance can not be empty. | |
| 403 | InvalidParameter.SplitOrMerge | The Many-to-many of modification is not supported. | |
| 403 | MissingParameter.InstanceTypeAndAmountBothEmpty | The instanceType and amount can not be both empty. | |
| 403 | InvalidReservedInstancePlatform.ValueNotSupported | The Platform is not supported. | |
| 403 | InvalidParameter.ReservedInstanceName | The reservedInstanceName is invalid. | reservedInstanceName字段值不合法 |
| 403 | InvalidReservedInstanceZone.ValueNotSupported | The zoneId is not exist. | |
| 403 | InvalidParameter.ValueNotSupported | The instanceTypeFamily of the instance to be changed must be consistent. | |
| 403 | IncorrectInstanceStatus | The status of specified reservedInstance must be active. | 预留实例券状态不正确导致续费失败 |
| 403 | InvalidPlatform.ValueNotSupported | The platform of reservedInstance is invalid. | |
| 403 | InvalidScope.ValueNotSupported | The scope of reservedInstance is invalid. The valid value is Zone or Region. | |
| 403 | InvalidConfiguration.ValueNotSupported | The modification Configuration should not be empty. | |
| 403 | InvalidZoneId.ValueNotSupported | The specified zoneId should be same. | |
| 403 | InvalidParameter | The parameter is invalid.Please check it. | |
| 403 | InvalidInstanceAmount.ValueNotSupported | The instanceAmount is invalid. | |
| 403 | OperationDenied.OnlyModifyName | It is not allowed to modify the ReservedInstanceName only. | 不允许只修改预留实例券的名称。 |
| 403 | InvalidReservedInstanceId.NotFound | The specified parameter ReservedInstanceId is invalid. | |
| 404 | InvalidZoneId.NotFound | The ZoneId provided does not exist in our records. |
访问错误中心查看更多错误码。
变更历史
更多信息,参考变更详情。