全部產品
Search
文件中心

Elastic Compute Service:DescribeCapacityReservations - 查詢容量預定服務的資訊

更新時間:Jun 04, 2026

查詢一個或多個容量預定服務的詳細資料,例如服務的狀態、服務的生效與失效時間、私人池的模式和已使用的執行個體的數量等。

調試

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

調試

授權資訊

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

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

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

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

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

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

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

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

操作

存取層級

資源類型

條件關鍵字

關聯操作

ecs:DescribeCapacityReservations

get

*CapacityReservation

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

請求參數

名稱

類型

必填

描述

樣本值

RegionId

string

容量預定服務所屬地區 ID。您可以調用 DescribeRegions 查看最新的阿里雲地區列表。

cn-hangzhou

ResourceGroupId

string

資源群組 ID。使用該參數過濾資源時,資源數量不能超過 1000 個。

說明

不支援預設資源群組過濾。

rg-bp67acfmxazb4p****

Tag

array<object>

容量預定服務綁定的標籤對集合。

object

標籤對。

Key

string

標籤鍵。N 表示可以設定多個標籤鍵進行過濾,N 的取值範圍為 1~20。

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

TestKey

Value

string

標籤值。N 表示可以設定多個標籤值進行過濾,N 的取值範圍為 1~20。

TestValue

MaxResults

integer

分頁查詢時每頁行數。

最大值:100。

預設值:10。

10

NextToken

string

容量預定服務查詢起始標誌。由上一次的請求結果中擷取。

caeba0bbb2be03f84eb48b699f0a4883

PrivatePoolOptions.Ids

string

容量預定服務 ID 列表。取值可以由多個 ID 組成一個 JSON 數組,最多支援 100 個 ID,ID 之間用半形逗號(,)隔開。

["crp-bp1gubrkqutenqdd****", "crp-bp67acfmxazb5****"]

Platform

string

執行個體的作業系統。取值範圍:

  • windows:僅查詢 Windows 系統的容量預定服務。

  • linux:僅查 Linux 系統的容量預定服務。

  • all:查詢所有容量預定服務。

預設值:all。

linux

InstanceType

string

執行個體規格。通過執行個體規格只可以查詢還在生效中的容量預定服務,已釋放的服務只能通過 PrivatePoolOptions.Ids 查詢。

ecs.c6.large

ZoneId

string

容量預定服務所屬的可用性區域 ID。

cn-hangzhou-h

InstanceChargeType

string

執行個體的計費方式。取值範圍:

  • PostPaid:隨用隨付。

  • PrePaid:訂用帳戶。

預設值:PostPaid。

PostPaid

Status

string

容量預定服務的狀態。取值範圍:

  • All:所有狀態。

  • Pending:初始化。指定時間生效的容量預定會先進入初始化狀態。

  • Preparing:準備中。指定時間生效的容量預定在資源交付進行階段,處於準備中狀態。

  • Prepared:待生效。指定時間生效的容量預定在資源交付完成,服務正式生效之前,處於待生效狀態。

  • Active:生效中。

  • Released:已釋放,包括手動釋放與到期自動釋放。

若不指定,則查詢除 Pending、Released 以外狀態的容量預定。

Active

返回參數

名稱

類型

描述

樣本值

object

NextToken

string

容量預定服務下一個查詢起始標誌。

caeba0bbb2be03f84eb48b699f0a****

RequestId

string

請求 ID。

473469C7-AA6F-4DC5-B3DB-A3DC0DE3****

TotalCount

integer

符合查詢條件的記錄條數。

1

MaxResults

integer

容量預定服務每頁顯示行數。

10

CapacityReservationSet

object

CapacityReservationItem

array<object>

容量預定服務詳細資料組成的集合。

array<object>

容量預定服務詳細資料。

Status

string

容量預定服務的狀態。可能值:

  • Pending:初始化。

  • Preparing:準備中。

  • Prepared:待生效。

  • Active:生效中。

  • Released:已釋放,包括手動釋放與到期自動釋放。

Active

TimeSlot

string

說明

該參數正在邀測中,暫未開放使用。

null

PrivatePoolOptionsMatchCriteria

string

容量預定服務生效後產生的私人資源集區的類型。可能值:

  • Open:開放模式。啟動執行個體時將自動匹配開放類型的私人池容量。如果沒有合格私人池容量,則使用公用池資源啟動。

  • Target:專用模式。使用指定的私人池容量啟動執行個體,如果該私人池容量不可用,則執行個體會啟動失敗。

Open

PrivatePoolOptionsId

string

容量預定服務 ID。

crp-bp1gubrkqutenqdd****

PrivatePoolOptionsName

string

容量預定服務名稱。

crpTestName

RegionId

string

容量預定服務所屬地區 ID。

cn-hangzhou

InstanceChargeType

string

容量預定服務中執行個體的付費類型。可能值:

  • PostPaid:隨用隨付。

  • PrePaid:訂用帳戶。

PostPaid

EndTime

string

容量預定服務的失效時間。

2021-02-19T03:02Z

StartTime

string

容量預定服務生效時間。

2021-02-19T02:01Z

Description

string

容量預定服務的描述。

This is description.

EndTimeType

string

容量預定服務的失效方式。可能值:

  • Limited:指定時間釋放。

  • Unlimited:手動釋放。不限制時間。

Unlimited

ResourceGroupId

string

容量預定服務所屬的資源群組 ID。

rg-bp67acfmxazb4p****

Platform

string

匹配的執行個體的作業系統。可能值:

  • windows。

  • linux。

linux

AllocatedResources

object

AllocatedResource

array<object>

資源分派詳情列表。

array<object>

資源分派詳情。

UsedAmount

integer

已使用的執行個體的數量。

2

TotalAmount

integer

在一個執行個體規格內,需要預留的執行個體的總數量。

2

AvailableAmount

integer

可用的執行個體數量。

2

FailedAmount

integer

1

LockedAmount

integer

1

zoneId

string

可用性區域 ID。

cn-hangzhou-h

InstanceType

string

執行個體規格。

ecs.c6.large

CapacityReservationUsages

object

CapacityReservationUsage

array<object>

已使用的執行個體詳情列表。

object

已使用的執行個體詳情。

AccountId

string

阿里雲帳號 ID。

105909559088****

ServiceName

string

阿里雲服務名稱。

maxcompute.aliyuncs.com

UsedAmount

integer

該阿里雲帳號或服務已使用執行個體的數量。

20

Tags

object

Tag

array<object>

容量預定服務綁定的標籤索引值對資訊列表。

object

容量預定服務綁定的標籤索引值對資訊。

TagValue

string

標籤值。

TestValue

TagKey

string

標籤鍵。

TestKey

StartTimeType

string

容量預定生效方式。可能值:

  • Now:立即生效。

  • Later:指定時間生效。

Now

SavingPlanId

string

容量預定搭配的節省計劃券 ID。

spn-c29b5e18pJMT****

ReservedInstanceId

string

容量預定搭配的預留執行個體券 ID。

ri-bpzhex2ulpzf53****

CapacityReservationOwnerId

string

容量預定資源套件所有者 ID。

100************7

DeliveryTime

string

UnlockedTime

string

樣本

正常返回樣本

JSON格式

{
  "NextToken": "caeba0bbb2be03f84eb48b699f0a****",
  "RequestId": "473469C7-AA6F-4DC5-B3DB-A3DC0DE3****",
  "TotalCount": 1,
  "MaxResults": 10,
  "CapacityReservationSet": {
    "CapacityReservationItem": [
      {
        "Status": "Active",
        "TimeSlot": "null",
        "PrivatePoolOptionsMatchCriteria": "Open",
        "PrivatePoolOptionsId": "crp-bp1gubrkqutenqdd****",
        "PrivatePoolOptionsName": "crpTestName",
        "RegionId": "cn-hangzhou",
        "InstanceChargeType": "PostPaid",
        "EndTime": "2021-02-19T03:02Z",
        "StartTime": "2021-02-19T02:01Z",
        "Description": "This is description.",
        "EndTimeType": "Unlimited",
        "ResourceGroupId": "rg-bp67acfmxazb4p****",
        "Platform": "linux",
        "AllocatedResources": {
          "AllocatedResource": [
            {
              "UsedAmount": 2,
              "TotalAmount": 2,
              "AvailableAmount": 2,
              "FailedAmount": 1,
              "LockedAmount": 1,
              "zoneId": "cn-hangzhou-h",
              "InstanceType": "ecs.c6.large",
              "CapacityReservationUsages": {
                "CapacityReservationUsage": [
                  {
                    "AccountId": "105909559088****",
                    "ServiceName": "maxcompute.aliyuncs.com",
                    "UsedAmount": 20
                  }
                ]
              }
            }
          ]
        },
        "Tags": {
          "Tag": [
            {
              "TagValue": "TestValue",
              "TagKey": "TestKey"
            }
          ]
        },
        "StartTimeType": "Now",
        "SavingPlanId": "spn-c29b5e18pJMT****",
        "ReservedInstanceId": "ri-bpzhex2ulpzf53****",
        "CapacityReservationOwnerId": "100************7\n",
        "DeliveryTime": "",
        "UnlockedTime": ""
      }
    ]
  }
}

錯誤碼

HTTP status code

錯誤碼

錯誤資訊

描述

400 MissingParameter.RegionId The specified RegionId should not be null. RegionId是必選參數。
400 InvalidParameter.Name The specified PrivatePoolOptions.Name is invalid.
400 InvalidParameter.PrivatePoolOptions.Ids The specified PrivatePoolOptions.Ids is invalid.
400 DedicatedHostNotSupported DedicatedHost is not supported for PrivatePool. 私人池不支援Dedicated Host。
400 SpotNotSupported Spot is not supported for PrivatePool. 私人池不支援搶佔式執行個體。
400 ClassicNetworkNotSupported Classic network is not supported for PrivatePool. 私人池不支援傳統網路類型執行個體。
400 Invalid.InstanceId Instance does not exist. 執行個體不存在。
400 Invalid.PrivatePoolOptions.MatchCriteria Target mode does not support this operation. Target模式不支援本次操作。
400 MissingParameter.PrivatePoolOptions.Id The specified PrivatePoolOptions.Id should not be null. PrivatePoolOptions.Id 參數不可為空。
400 Invalid.PrivatePoolOptions.Id The PrivatePool does not exist. 私人池不存在。
400 Invalid.InstanceType The InstanceType does not match the PrivatePool. 執行個體類型與私人池不匹配。
400 Invalid.InstanceChargeType The InstanceChargeType does not match the PrivatePool. 執行個體計費類型與私人池不匹配。
400 Invalid.ZoneId The ZoneId does not match the PrivatePool. 可用性區域與私人池不匹配。
400 Invalid.PrivatePoolOptions.status The PrivatePool has been used up. 該資源已用完。
400 InvalidPlatform.ValueNotSupported The Platform does not match the PrivatePool. 指定的Platform參數與私人池不匹配。
400 InvalidAliUid The PrivatePool does not belong to the user of the Instance. 私人池不屬於建立執行個體的使用者。
400 MissingParameter.PackageType The specified parameter "PackageType" can not be empty. 指定的參數PackageType不可為空。
400 MissingParameter.PrivatePoolOptions.Ids The specified parameter "PrivatePoolOptions.Ids" can not be empty. 指定參數“PrivatePoolOptions.ids”不可為空。
400 MissingParameter.InstanceCpuCoreCount The specified parameter "InstanceCpuCoreCount" can not be empty. 指定的參數 'InstanceCpuCocount'不可為空。
400 MissingParameter.InstanceAmount The specified parameter "InstanceAmount" can not be empty. 指定的參數InstanceAmount不可為空。
400 MissingParameter.InstanceCpuCoreCountOrInstanceAmount The specified parameter "InstanceCpuCoreCount" and "InstanceAmount" must not be empty at the same time. 指定的參數InstanceCpuCoreCount和InstanceAmount不能同時為空白。
400 Invalid.TooManyPrivatePoolOptions.Ids Too many PrivatePoolOptions.Ids in this request. PrivatePoolOptions.Ids參數超過上限。
400 Invalid.TooManyZoneIds Too many ZoneIds in the request. ZoneIds參數超過上限。
400 Invalid.TooManyInstanceTypes Too many InstanceTypes in the request. InstanceTypes參數超過上限。
400 Invalid.TooManyUnpaidPrivatePool Too many PrivatePools create but still unpaid. 多個私人池未支付。
400 Invalid.InstanceCpuCoreCountOrInstanceAmount Both InstanceCpuCoreCount and InstanceAmount are provided. InstanceCpuCoreCount和InstanceAmount兩個參數不需要同時提供。
400 Invalid.PrivatePoolOptions.Ids The specified parameter "PrivatePoolOptions.Ids" exist invalid element Id. 指定的私人池ID不存在。
400 Invalid.PackageType The specified parameter "PackageType" is invalid. 指定的參數“PackageType”無效。
400 Invalid.PrivatePool.Purchase The PrivatePool has already paid. 私人池已經支付。
400 Invalid.AssuranceTimes.NotSupported The value of AssuranceTimes is not supported. AssuranceTimes參數值不支援。
400 RepeatStartPrivatePool PrivatePool has already been started. 私人池已經啟動。
400 InvalidParameter.RegionId The specified RegionId is not exist.
400 InvalidPermission.ResourceShareAssocoated The current resource is associated to a shared relationship and cannot be released. 當前資源被綁定共用關係,無法釋放
500 InternalError The request processing has failed due to some unknown error, exception or failure. 內部錯誤,請重試。

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

變更歷史

更多資訊,參考變更詳情