全部產品
Search
文件中心

Elastic Compute Service:DescribeReservedInstances - 查詢預留執行個體券詳細資料列表

更新時間:Apr 04, 2026

本介面主要用於查詢指定地區下您已經購買的預留執行個體券資訊列表,支援您根據標籤、預留執行個體券屬性等參數擷取預留執行個體券詳細資料列表。

介面說明

適用情境

  • 查詢指定地區下所有的預留執行個體券。

  • 根據預留執行個體券 ID 或名稱查詢其詳細資料。

  • 根據執行個體規格或者執行個體規格類型系列過濾查詢您已購買的預留執行個體券。

  • 根據預留執行個體券範圍或者狀態過濾查詢您已購買的預留執行個體券。

請求樣本

樣本:查詢杭州地區下所有已購買的預留執行個體券

"Region":"cn-hangzhou" //設定地區為杭州

樣本:查詢杭州地區下 ID 為 ecsri-bp129enntoynwwj5****的預留執行個體券的詳細資料

"Region":"cn-hangzhou", //設定地區為杭州
"ReservedInstanceId":"ecsri-bp129enntoynwwj5****" //設定預留執行個體券 ID

樣本:查詢杭州地區下可以抵扣執行個體規格為 ecs.c5.2xlarge 的預留執行個體券

"Region":"cn-hangzhou", //設定地區為杭州
"InstanceType":"ecs.c5.2xlarge" //設定執行個體規格

樣本:查詢杭州地區下在有效期間中的地區級預留執行個體券

"Region":"cn-hangzhou", //設定地區為杭州
"Scope":"Region", //設定預留執行個體券範圍
"Status":["Active"] //設定狀態為在有效期間中

調試

您可以在OpenAPI Explorer中直接運行該介面,免去您計算簽名的困擾。運行成功後,OpenAPI Explorer可以自動產生SDK程式碼範例。

調試

授權資訊

下表是API對應的授權資訊,可以在RAM權限原則語句的Action元素中使用,用來給RAM使用者或RAM角色授予調用此API的許可權。具體說明如下:

  • 操作:是指具體的許可權點。

  • 存取層級:是指每個操作的存取層級,取值為寫入(Write)、讀取(Read)或列出(List)。

  • 資源類型:是指操作中支援授權的資源類型。具體說明如下:

    • 對於必選的資源類型,用前面加 * 表示。

    • 對於不支援資源級授權的操作,用全部資源表示。

  • 條件關鍵字:是指雲產品自身定義的條件關鍵字。

  • 關聯操作:是指成功執行操作所需要的其他許可權。操作者必須同時具備關聯操作的許可權,操作才能成功。

操作

存取層級

資源類型

條件關鍵字

關聯操作

ecs:DescribeReservedInstances

get

ReservedInstance

acs:ecs:{#regionId}:{#accountId}:reservedinstance/*

ReservedInstance

acs:ecs:{#regionId}:{#accountId}:reservedinstance/{#reservedinstanceId}

請求參數

名稱

類型

必填

描述

樣本值

RegionId

string

預留執行個體券所屬的地區 ID。您可以調用 DescribeRegions 擷取最新的阿里雲地區列表。

cn-hangzhou

PageNumber

integer

預留執行個體券列表的頁碼,起始值:1。

預設值:1。

1

PageSize

integer

分頁查詢時的每頁行數,最大值:100。

預設值:10。

50

Tag

array<object>

標籤數組。數組長度:1~20。

object

標籤。

Key

string

預留執行個體券的標籤鍵。不允許為空白字串,最多支援 128 個字元,不能以 aliyun 和 acs:開頭,不能包含 http://或者 https://。

說明

使用一個標籤過濾資源,查詢到該標籤下的資源數量不能超過 1000 個;使用多個標籤過濾資源,查詢到同時綁定了多個標籤的資源數量不能超過 1000 個;如果資源數量超過 1000 個,請使用 ListTagResources 介面進行查詢。

TestKey

Value

string

預留執行個體券的標籤值。不允許為空白字串,最多支援 128 個字元,不能以acs:開頭,不能包含http://或者https://

TestValue

RegionId

string

預留執行個體券所屬的地區 ID。您可以調用 DescribeRegions 擷取最新的阿里雲地區列表。

cn-hangzhou

ZoneId

string

執行個體所屬的可用性區域編號,當 Scope 為 Zone 時生效並且必填。您可以通過 DescribeZones 擷取可用性區域列表。

cn-hangzhou-z

ReservedInstanceName

string

預留執行個體券名稱。

說明

完全符合,暫不支援模糊查詢過濾。

testReservedInstanceName

LockReason

string

鎖定類型。取值範圍:

  • financial:帳號欠費或服務到期。

  • security:安全原因。

security

InstanceType

string

預留執行個體券對應的執行個體規格。取值請參見執行個體規格類型系列

說明

購買預留執行個體券時選擇的執行個體規格,實際抵扣的時候,地區級預留執行個體券支援同規格組內的不同大小規格換算抵扣。

ecs.g5.large

InstanceTypeFamily

string

預留執行個體券對應的執行個體規格類型系列。取值請參見執行個體規格類型系列

ecs.g5

Scope

string

預留執行個體券的範圍。取值範圍:

  • Region:地區層級。

  • Zone:可用性區域層級。

Region

OfferingType

string

預留執行個體券的付款類型。取值範圍:

  • No Upfront:零預付。

  • Partial Upfront:部分預付。

  • All Upfront:全預付。

All Upfront

AllocationType

string

配置類型。取值範圍:

  • Normal:查詢當前帳號下的預留執行個體券。

  • Shared:查詢當前帳號下已經建立主子帳號共用的預留執行個體券。

預設值:Normal。

Normal

ReservedInstanceId

array

預留執行個體券 ID 數組。數組長度:1~100。

ri-bpzhex2ulpzf53****

string

預留執行個體券 ID。

ri-bpzhex2ulpzf53****

Status

array

預留執行個體券的狀態數組。

Active

string

預留執行個體券的狀態。狀態值取值範圍:

  • Creating:正在建立。

  • Active:在有效期間中。

  • Retired:失效。

  • Updating:正在更改預留執行個體券的屬性。

  • Expired:已到期。預留執行個體券到期後立即失效,該取值目前已廢棄,後續將移除。

Active

返回參數

名稱

類型

描述

樣本值

object

PageSize

integer

輸入時設定的每頁行數。

1

RequestId

string

請求 ID。

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

PageNumber

integer

預留執行個體券列表的頁碼。

1

TotalCount

integer

預留執行個體券的總數。

1

ReservedInstances

object

ReservedInstance

array<object>

預留執行個體券的詳細資料列表。

array<object>

預留執行個體券的詳細資料。

Status

string

狀態。

Active

CreationTime

string

建立時間。

2018-12-10T12:07Z

ReservedInstanceName

string

名稱。

riZbpzhex2ulpzf53****

ReservedInstanceId

string

預留執行個體券 ID。

ri-bpzhex2ulpzf53****

InstanceType

string

匹配的隨用隨付執行個體的規格。

ecs.g5.large

InstanceAmount

integer

可以匹配同規格隨用隨付執行個體的數量。

10

RegionId

string

地區 ID。

cn-hangzhou

OfferingType

string

付款類型。

All Upfront

StartTime

string

生效時間。

2018-12-10T12:00Z

Description

string

描述。

testDescription

AllocationStatus

string

當 AllocationType 值為 Shared 時,該參數表示預留執行個體券的分配狀態。可能值:

  • allocated:已指派給其他使用者的預留執行個體券。

  • beAllocated:被其他使用者指派的預留執行個體券。

allocated

ExpiredTime

string

到期時間。

2019-12-10T12:07Z

ResourceGroupId

string

資源群組。

EcsDocTest

ZoneId

string

可用性區域 ID。

cn-hangzhou-z

Platform

string

執行個體使用的鏡像的作業系統類型。可能值:

  • Windows:Windows Server 類型的作業系統。

  • Linux:Linux 及類 Unix 類型的作業系統。

Linux

Scope

string

範圍。

region

OperationLocks

object

OperationLock

array<object>

是否被鎖定。

object

是否被鎖定。

LockReason

string

鎖定原因。

security

Tags

object

Tag

array<object>

預留執行個體券的標籤對資訊列表。

object

預留執行個體券的標籤對資訊。

TagValue

string

預留執行個體券的標籤值。

TestValue

TagKey

string

預留執行個體券的標籤鍵。

TestKey

樣本

正常返回樣本

JSON格式

{
  "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"
            }
          ]
        }
      }
    ]
  }
}

異常返回樣本

JSON格式

{
    "code":"200",
    "data":{
        "data":[
            {
                "CreationTime":"2018-12-10T12:07Z",
                "ExpiredTime":"2019-12-10T16:00Z",
                "InstanceAmount":1,
                "ReservedInstanceId":"ri-0xzhex2ulpzf53rxme2j",
                "InstanceType":"ecs.g5.large",
                "OfferingType":"All Upfront",
                "RegionId":"cn-hangzhou-test-307",
                "ReservedInstanceName":"riZ0xzhex2ulpzf53rxme2jZ",
                "Scope":"region",
                "StartTime":"2018-12-10T12:00Z",
                "Status":"active"
            }
        ],
        "PageNumber":1,
        "PageSize":50,
        "Total":1
    },
    "httpStatusCode":200,
    "message":"successful",
    "requestId":"E572643C-6A29-49D6-9D4E-6CFA4E063A3E",
    "success":true
}

錯誤碼

HTTP status code

錯誤碼

錯誤資訊

描述

400 MissingParamter.RegionId The regionId should not be null. 參數 RegionId 不得為空白。
400 InvalidRegion.NotFound The specified parameter RegionId is not valid. RegionId 參數不合法。
400 InvalidZone.NotFound The specified parameter ZoneId is not valid. 指定的ZoneId不合法。
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. 指定的 EndTime 超過限制。
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. 指定的配置類型無效。
403 RAM.ApiNotSupported This call is not supported from ram accessing. RAM 使用者沒有許可權執行該操作。
404 InvalidRegionId.NotFound The specified RegionId does not exist in our records. 指定的RegionId不存在,請您檢查此產品在該地區是否可用。

訪問錯誤中心查看更多錯誤碼。

變更歷史

更多資訊,參考變更詳情