Queries the details of reserved instances that you have purchased. You can query the details of reserved instances based on parameters, such as tags and reserved instance attributes.
Debugging
Authorization information
The following table shows the authorization information corresponding to the API. The authorization information can be used in the Action
policy element to grant a RAM user or RAM role the permissions to call this API operation. Description:
- Operation: the value that you can use in the Action element to specify the operation on a resource.
- Access level: the access level of each operation. The levels are read, write, and list.
- Resource type: the type of the resource on which you can authorize the RAM user or the RAM role to perform the operation. Take note of the following items:
- The required resource types are displayed in bold characters.
- If the permissions cannot be granted at the resource level,
All Resources
is used in the Resource type column of the operation.
- Condition Key: the condition key that is defined by the cloud service.
- Associated operation: other operations that the RAM user or the RAM role must have permissions to perform to complete the operation. To complete the operation, the RAM user or the RAM role must have the permissions to perform the associated operations.
Operation | Access level | Resource type | Condition key | Associated operation |
---|---|---|---|---|
ecs:DescribeReservedInstances | get | *ReservedInstance acs:ecs:{#regionId}:{#accountId}:reservedinstance/* *ReservedInstance acs:ecs:{#regionId}:{#accountId}:reservedinstance/{#reservedinstanceId} |
| none |
Request parameters
Parameter | Type | Required | Description | Example |
---|---|---|---|---|
RegionId | string | Yes | The region ID of the instances. You can call the DescribeRegions operation to query the most recent region list. | cn-hangzhou |
PageNumber | integer | No | The page number. Pages start from page 1. Default value: 1. | 1 |
PageSize | integer | No | The number of entries per page. Valid values: 1 to 100. Default value: 10. | 50 |
Tag | array<object> | No | The tags of the reserved instance. You can specify up to 20 tags. | |
object | No | Tag N of the reserved instance. | ||
Key | string | No | The key of tag N of the reserved instance. The tag key cannot be empty and can be up to 128 characters in length. It cannot start with aliyun or acs: and cannot contain http:// or https://. Note
If you specify a single tag to query resources, up to 1,000 resources to which the tag is added are returned. If you specify multiple tags to query resources, up to 1,000 resources to which all specified tags are added are returned. To query more than 1,000 resources that have specified tags added, call the ListTagResources operation.
| TestKey |
Value | string | No | The value of tag N of the reserved instance. The tag value cannot be empty and can be up to 128 characters in length. It cannot start with | TestValue |
ZoneId | string | No | The zone ID of the reserved instances. This parameter is required when Scope is set to Zone. You can call the DescribeZones operation to query the most recent zone list. | cn-hangzhou-z |
ReservedInstanceName | string | No | The name of the reserved instance. | testReservedInstanceName |
LockReason | string | No | The reason why the reserved instance is locked. Valid values:
| security |
InstanceType | string | No | The instance type. For more information, see Instance families. | ecs.g5.large |
InstanceTypeFamily | string | No | The instance family. For more information, see Instance families. | ecs.g5 |
Scope | string | No | The scope of the reserved instance. Valid values:
Default value: Region. | Region |
OfferingType | string | No | The payment option of the reserved instance. Valid values:
| All Upfront |
AllocationType | string | No | The allocation type of the reserved instances. Valid values:
Default value: Normal. | Normal |
ReservedInstanceId | array | No | The IDs of reserved instances. You can specify up to 100 IDs of reserved instances. | |
string | No | The ID of reserved instance N. | ri-bpzhex2ulpzf53**** | |
Status | array | No | The statuses of the reserved instances. | |
string | No | The status of reserved instance N. Valid values:
| Active |
Response parameters
Examples
Sample success responses
JSON
format
{
"PageSize": 1,
"RequestId": "E572643C-6A29-49D6-9D4E-6CFA4E063A3E",
"PageNumber": 1,
"TotalCount": 1,
"ReservedInstances": {
"ReservedInstance": [
{
"Status": "Active",
"CreationTime": "2018-12-10T12:07Z",
"ReservedInstanceName": "riZbpzhex2ulpzf53****",
"ReservedInstanceId": "ri-bpzhex2ulpzf53****",
"InstanceType": "ecs.g5.large",
"InstanceAmount": 10,
"RegionId": "cn-hangzhou",
"OfferingType": "All Upfront",
"StartTime": "2018-12-10T12:00Z",
"Description": "testDescription",
"AllocationStatus": "allocated",
"ExpiredTime": "2019-12-10T12:07Z",
"ResourceGroupId": "EcsDocTest",
"ZoneId": "cn-hangzhou-z",
"Platform": "Linux",
"Scope": "region",
"OperationLocks": {
"OperationLock": [
{
"LockReason": "security"
}
]
},
"Tags": {
"Tag": [
{
"TagValue": "TestValue",
"TagKey": "TestKey"
}
]
}
}
]
}
}
Error codes
HTTP status code | Error code | Error message | Description |
---|---|---|---|
400 | MissingParamter.RegionId | The regionId should not be null. | The RegionId parameter is required. |
400 | InvalidRegion.NotFound | The specified parameter RegionId is not valid. | The specified RegionId parameter is invalid. |
400 | InvalidZone.NotFound | The specified parameter ZoneId is not valid. | The specified ZoneId parameter is invalid. |
400 | InvalidReservedInstanceOfferingType.ValueNotSupported | the OfferingType is not supported | - |
400 | InvalidReservedInstanceOfferingClass.ValueNotSupported | the OfferingClass is not supported | - |
400 | OperationDenied | The specified InstanceType or Zone is not authorized for current user. | - |
400 | InvalidEndTime.ValueNotSupported | The specified endTime is out of the permitted range. | The specified end time is invalid. |
400 | InvalidReservedInstanceLockReason.ValueNotSupported | The specified LockReason is not supported. | - |
400 | InvalidReservedInstanceStatus.ValueNotSupported | The specified Status is not supported. | - |
400 | InvalidAllocationType.ValueNotSupported | The specified AllocationType is not supported. | The specified AllocationType parameter is invalid. |
404 | InvalidRegionId.NotFound | The specified RegionId does not exist in our records. | The specified RegionId parameter does not exist. Check whether the service is available in the specified region. |
For a list of error codes, visit the Service error codes.
Change history
Change time | Summary of changes | Operation |
---|