All Products
Search
Document Center

Elastic Compute Service:DescribeReservedInstances

Last Updated:Nov 29, 2023

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. OpenAPI Explorer dynamically generates the sample code of the operation for different SDKs.

Request parameters

Parameter

Type

Required

Example

Description

Action String Yes DescribeReservedInstances

The operation that you want to perform. Set the value to DescribeReservedInstances.

RegionId String Yes cn-hangzhou

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

PageNumber Integer No 1

The page number. Pages start from page 1.

Default value: 1.

PageSize Integer No 50

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

Default value: 10.

Tag.N.Key String No TestKey

The key of tag N of 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 start with acs: or aliyun. It cannot contain http:// or https://.

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 to which the specified tags are added, call the ListTagResources operation.

Tag.N.Value String No TestValue

The value of tag N of 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:.

ZoneId String No cn-hangzhou-z

The zone ID of the reserved instance. This parameter is required when Scope is set to Zone. You can call the DescribeZones operation to query the most recent zone list.

ReservedInstanceName String No testReservedInstanceName

The name of the reserved instance.

LockReason String No security

The reason why the reserved instance is locked. Valid values:

  • financial: locks the reserved instance because the account has overdue payments or the service expires.
  • security: locks the reserved instance due to security reasons.
InstanceType String No ecs.g5.large

The instance type of the reserved instance. For information about the values, see Overview of instance families.

InstanceTypeFamily String No ecs.g5

The instance family of the reserved instance. For information about the values, see Overview of instance families.

Scope String No Region

The scope of the reserved instance. Valid values:

  • Region
  • Zone

Default value: Region.

OfferingType String No All Upfront

The billing method of the reserved instance. Valid values:

  • No Upfront
  • Partial Upfront
  • All Upfront
AllocationType String No Normal

The allocation type of the reserved instances. Valid values:

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

Default value: Normal.

ReservedInstanceId.N String No ri-bpzhex2ulpzf53****

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

Status.N String No Active

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

  • Creating: The reserved instance is being created.
  • Active: The reserved instance is active.
  • Expired: The reserved instance is expired.
  • Updating: The properties of the reserved instance are being modified.

Response parameters

Parameter

Type

Example

Description

PageSize Integer 1

The number of entries per page.

RequestId String E572643C-6A29-49D6-9D4E-6CFA4E063A3E

The ID of the request.

PageNumber Integer 1

The page number.

TotalCount Integer 1

The total number of reserved instances.

ReservedInstances Array of ReservedInstance

Details about the reserved instances.

ReservedInstance
Status String Active

The state of the reserved instance.

CreationTime String 2018-12-10T12:07Z

The time when the reserved instance was created.

ReservedInstanceName String riZbpzhex2ulpzf53****

The name of the reserved instance.

ReservedInstanceId String ri-bpzhex2ulpzf53****

The ID of the reserved instance.

InstanceType String ecs.g5.large

The instance type of the pay-as-you-go instances that match each reserved instance.

InstanceAmount Integer 10

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

RegionId String cn-hangzhou

The region ID of the reserved instance.

OfferingType String All Upfront

The billing method of the reserved instance.

StartTime String 2018-12-10T12:00Z

The time when the reserve instances took effect.

Description String testDescription

The description of the reserved instance.

AllocationStatus String allocated

The allocation 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.
ExpiredTime String 2019-12-10T12:07Z

The time when the reserved instance expires.

ResourceGroupId String EcsDocTest

The ID of the resource group.

ZoneId String cn-hangzhou-z

The ID of the zone.

Platform String Linux

The operating system type. Valid values:

  • Windows
  • Linux
Scope String region

The scope of the reserved instance.

OperationLocks Array of OperationLock

Details about the lock status of the reserved instances.

OperationLock
LockReason String security

The reason why the reserved instance was locked.

Tags Array of Tag

The tags of the reserved instance.

Tag
TagValue String TestValue

The tag value of the reserved instance.

TagKey String TestKey

The tag key of the reserved instance.

Examples

Sample requests

https://ecs.aliyuncs.com/?Action=DescribeReservedInstances
&RegionId=cn-hangzhou
&Scope=Region
&<Common request parameters>

Sample success responses

XML format

HTTP/1.1 200 OK
Content-Type:application/xml

<DescribeReservedInstancesResponse>
    <ReservedInstances>
        <ReservedInstance>
            <CreationTime>2018-12-10T12:07Z</CreationTime>
            <ExpiredTime>2019-12-10T16:00Z</ExpiredTime>
            <InstanceAmount>1</InstanceAmount>
            <ReservedInstanceId>ri-0xzhex2ulpzf53****</ReservedInstanceId>
            <InstanceType>ecs.g5.large</InstanceType>
            <OfferingType>All Upfront</OfferingType>
            <RegionId>cn-hangzhou-test-307</RegionId>
            <ReservedInstanceName>riZ0xzhex2ulpzf53****</ReservedInstanceName>
            <Scope>region</Scope>
            <StartTime>2018-12-10T12:00Z</StartTime>
            <Status>Active</Status>
            <Tags>
                <Tag>
                    <TagKey>TestKey</TagKey>
                    <TagValue>TestValue</TagValue>
                </Tag>
            </Tags>
        </ReservedInstance>
    </ReservedInstances>
    <RequestId>E572643C-6A29-49D6-9D4E-6CFA4E063A3E</RequestId>
    <PageNumber>1</PageNumber>
    <PageSize>50</PageSize>
    <Total>1</Total>
</DescribeReservedInstancesResponse>

JSON format

HTTP/1.1 200 OK
Content-Type:application/json

{
  "ReservedInstances" : {
    "ReservedInstance" : [ {
      "CreationTime" : "2018-12-10T12:07Z",
      "ExpiredTime" : "2019-12-10T16:00Z",
      "InstanceAmount" : 1,
      "ReservedInstanceId" : "ri-0xzhex2ulpzf53****",
      "InstanceType" : "ecs.g5.large",
      "OfferingType" : "All Upfront",
      "RegionId" : "cn-hangzhou-test-307",
      "ReservedInstanceName" : "riZ0xzhex2ulpzf53****",
      "Scope" : "region",
      "StartTime" : "2018-12-10T12:00Z",
      "Status" : "Active",
      "Tags" : {
        "Tag" : [ {
          "TagKey" : "TestKey",
          "TagValue" : "TestValue"
        } ]
      }
    } ]
  },
  "RequestId" : "E572643C-6A29-49D6-9D4E-6CFA4E063A3E",
  "PageNumber" : 1,
  "PageSize" : 50,
  "Total" : 1
}

Error codes

HTTP status code

Error code

Error message

Description

400 MissingParamter.RegionId The regionId should not be null. RegionId is required.
400 InvalidRegion.NotFound The specified parameter RegionId is not valid. Invalid RegionId value.
400 InvalidZone.NotFound The specified parameter ZoneId is not valid. Invalid ZoneId value.
400 InvalidEndTime.ValueNotSupported The specified endTime is out of the permitted range. Invalid EndTime value.
400 InvalidAllocationType.ValueNotSupported The specified AllocationType is not supported. Invalid AllocationType value.
404 InvalidRegionId.NotFound The specified RegionId does not exist in our records. The RegionId value is not found. Check whether the service is available in the specified region.

For a list of error codes, see Service error codes.