本介面的主要功能是通過修改執行個體規格、數量、可用性區域等預留執行個體券的配置來對預留執行個體券進行拆分、合并或範圍變更操作。
介面說明
本介面為非同步介面,介面調用成功後會返回新產生的預留執行個體券 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. |
訪問錯誤中心查看更多錯誤碼。
變更歷史
更多資訊,參考變更詳情。