All Products
Search
Document Center

Elastic Compute Service:DescribeReservedInstances

Last Updated:Apr 11, 2024

Queries purchased reserved instances.

Debugging

OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer.

Authorization information

There is currently no authorization information disclosed in the API.

Request parameters

ParameterTypeRequiredDescriptionExample
RegionIdstringYes

The region ID of the instances. You can call the DescribeRegions operation to query the most recent region list.

cn-hangzhou
PageNumberintegerNo

The page number. Pages start from page 1.

Default value: 1.

1
PageSizeintegerNo

The number of entries per page. Maximum value: 100.

Default value: 10.

50
Tagobject []No

The tags to add to the instances.

KeystringNo

The key of tag N to add to the reserved instance. Valid values of N: 1 to 20. The tag key cannot be an empty string. The tag key can be up to 128 characters in length and cannot contain http:// or https://. The tag key cannot start with acs: or aliyun.

Up to 1,000 resources with the specified tags can be returned in the response. To query more than 1,000 resources with the specified tags, call the ListTagResources operation.

TestKey
ValuestringNo

The value of tag N to add to the reserved instance. Valid values of N: 1 to 20. The tag value can be an empty string. The tag value can be up to 128 characters in length and cannot contain http:// or https://. The tag value cannot start with acs:.

TestValue
ZoneIdstringNo

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
ReservedInstanceNamestringNo

The name of the reserved instance.

testReservedInstanceName
LockReasonstringNo

The reason why the instance is locked. Valid values:

  • financial: You have an overdue payment in your account, or the reserved instance has expired.
  • security: The reserved instance is locked for security reasons.
security
InstanceTypestringNo

The instance type. For more information, see Instance families.

ecs.g5.large
InstanceTypeFamilystringNo

The instance family. For more information, see Instance families.

ecs.g5
ScopestringNo

The scope of the reserved instances. Valid values:

  • Region
  • Zone

Default value: Region.

Region
OfferingTypestringNo

The payment option of the reserved instances. Valid values:

  • No Upfront
  • Partial Upfront
  • All Upfront
All Upfront
AllocationTypestringNo

The allocation type. Valid values:

  • Normal: queries all reserved instances that belong to the current account.
  • Shared: queries reserved instances that are shared between the main account and linked accounts.

Default value: Normal.

Normal
ReservedInstanceIdarrayNo

The ID of reserved instance N. Valid values of N: 1 to 100.

stringNo

The ID of reserved instance N. Valid values of N: 1 to 100.

ri-bpzhex2ulpzf53****
StatusarrayNo

The status of reserved instance N. Valid values of N: 1 to 100. Valid values:

  • Creating
  • Active
  • Expired
  • Updating
stringNo

The status of reserved instance N. Valid values of N: 1 to 100. Valid values:

  • Creating
  • Active
  • Expired
  • Updating
Active

Response parameters

ParameterTypeDescriptionExample
object
PageSizeinteger

The number of entries per page.

1
RequestIdstring

The request ID.

E572643C-6A29-49D6-9D4E-6CFA4E063A3E
PageNumberinteger

The page number.

1
TotalCountinteger

The total number of reserved instances.

1
ReservedInstancesobject []

Details about the reserved instances.

Statusstring

The status.

Active
CreationTimestring

The creation time.

2018-12-10T12:07Z
ReservedInstanceNamestring

The name.

riZbpzhex2ulpzf53****
ReservedInstanceIdstring

The reserved instance ID.

ri-bpzhex2ulpzf53****
InstanceTypestring

The instance type of the pay-as-you-go instances that can be matched to the reserved instance.

ecs.g5.large
InstanceAmountinteger

The number of pay-as-you-go instances that are of the same instance type as the reserved instance and can be matched to the reserved instance.

10
RegionIdstring

The region ID.

cn-hangzhou
OfferingTypestring

The payment option.

All Upfront
StartTimestring

The effective time.

2018-12-10T12:00Z
Descriptionstring

The description.

testDescription
AllocationStatusstring

Indicates the sharing status of the reserved instance when the AllocationType parameter is set to Shared. Valid values:

  • allocated: The reserved instance is allocated to another account.
  • beAllocated: The reserved instance is allocated by another account.
allocated
ExpiredTimestring

The expiration time.

2019-12-10T12:07Z
ResourceGroupIdstring

The resource group ID.

EcsDocTest
ZoneIdstring

The zone ID.

cn-hangzhou-z
Platformstring

The operating system of the image used by the instance. Valid values:

  • Windows
  • Linux
Linux
Scopestring

The scope.

region
OperationLocksobject []

Details about the lock status of the reserved instance.

LockReasonstring

The reason why the instance is locked.

security
Tagsobject []

Details about the tags of the reserved instance.

TagValuestring

The tag value.

TestValue
TagKeystring

The tag key.

TestKey

Examples

Sample success responses

JSONformat

{
  "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 codeError codeError messageDescription
400MissingParamter.RegionIdThe regionId should not be null.The RegionId parameter is required.
400InvalidRegion.NotFoundThe specified parameter RegionId is not valid.The specified RegionId parameter is invalid.
400InvalidZone.NotFoundThe specified parameter ZoneId is not valid.The specified ZoneId parameter is invalid.
400InvalidReservedInstanceOfferingType.ValueNotSupportedthe OfferingType is not supported-
400InvalidReservedInstanceOfferingClass.ValueNotSupportedthe OfferingClass is not supported-
400OperationDeniedThe specified InstanceType or Zone is not authorized for current user.-
400InvalidEndTime.ValueNotSupportedThe specified endTime is out of the permitted range.The specified end time is invalid.
400InvalidReservedInstanceLockReason.ValueNotSupportedThe specified LockReason is not supported.-
400InvalidReservedInstanceStatus.ValueNotSupportedThe specified Status is not supported.-
400InvalidAllocationType.ValueNotSupportedThe specified AllocationType is not supported.The specified AllocationType parameter is invalid.
404InvalidRegionId.NotFoundThe 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.