All Products
Search
Document Center

Elastic Compute Service:DescribeReservedInstances

Last Updated:Sep 29, 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

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.
OperationAccess levelResource typeCondition keyAssociated operation
ecs:DescribeReservedInstancesget
  • ReservedInstance
    acs:ecs:{#regionId}:{#accountId}:reservedinstance/*
  • ReservedInstance
    acs:ecs:{#regionId}:{#accountId}:reservedinstance/{#reservedinstanceId}
    none
none

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
Tagarray<object>No

The tags to add to the instances.

objectNo

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
ReservedInstancesarray<object>

Details about the reserved instances.

ReservedInstanceobject
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
OperationLocksarray<object>

Details about the lock status of the reserved instance.

OperationLockobject
LockReasonstring

The reason why the instance is locked.

security
Tagsarray<object>

Details about the tags of the reserved instance.

Tagobject
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.

Change history

Change timeSummary of changesOperation
No change history