All Products
Search
Document Center

Elastic Compute Service:DescribeCapacityReservations

Last Updated:Jun 03, 2026

Returns details for one or more capacity reservation services, including their status, start and end times, private pool mode, and used instance count.

Try it now

Try this API in OpenAPI Explorer, no manual signing needed. Successful calls auto-generate SDK code matching your parameters. Download it with built-in credential security for local usage.

Test

RAM authorization

The table below describes the authorization required to call this API. You can define it in a Resource Access Management (RAM) policy. The table's columns are detailed below:

  • Action: The actions can be used in the Action element of RAM permission policy statements to grant permissions to perform the operation.

  • API: The API that you can call to perform the action.

  • Access level: The predefined level of access granted for each API. Valid values: create, list, get, update, and delete.

  • Resource type: The type of the resource that supports authorization to perform the action. It indicates if the action supports resource-level permission. The specified resource must be compatible with the action. Otherwise, the policy will be ineffective.

    • For APIs with resource-level permissions, required resource types are marked with an asterisk (*). Specify the corresponding Alibaba Cloud Resource Name (ARN) in the Resource element of the policy.

    • For APIs without resource-level permissions, it is shown as All Resources. Use an asterisk (*) in the Resource element of the policy.

  • Condition key: The condition keys defined by the service. The key allows for granular control, applying to either actions alone or actions associated with specific resources. In addition to service-specific condition keys, Alibaba Cloud provides a set of common condition keys applicable across all RAM-supported services.

  • Dependent action: The dependent actions required to run the action. To complete the action, the RAM user or the RAM role must have the permissions to perform all dependent actions.

Action

Access level

Resource type

Condition key

Dependent action

ecs:DescribeCapacityReservations

get

*CapacityReservation

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

None None

Request parameters

Parameter

Type

Required

Description

Example

RegionId

string

Yes

The region ID of the capacity reservation. You can call the DescribeRegions operation to query the latest list of Alibaba Cloud regions.

cn-hangzhou

ResourceGroupId

string

No

The ID of the resource group. When you use this parameter to filter resources, the operation returns a maximum of 1,000 resources.

Note

Filtering by the default resource group is not supported.

rg-bp67acfmxazb4p****

Tag

array<object>

No

The tags attached to the capacity reservations.

object

No

A tag.

Key

string

No

The key of the Nth tag. You can specify up to 20 tags.

A maximum of 1,000 resources that match the specified tags can be returned. If you specify multiple tags, only resources that have all of these tags are returned. If the number of matching resources exceeds 1,000, call the ListTagResources operation to query the resources.

TestKey

Value

string

No

The value of the Nth tag. You can specify up to 20 tags.

TestValue

MaxResults

integer

No

The number of entries to return on each page.

Maximum value: 100.

Default value: 10.

10

NextToken

string

No

The query token. Set the value to the NextToken value returned in the previous call to retrieve the next page of results.

caeba0bbb2be03f84eb48b699f0a4883

PrivatePoolOptions.Ids

string

No

The IDs of the capacity reservations. The value can be a JSON array that consists of up to 100 capacity reservation IDs.

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

Platform

string

No

The operating system of the instance. Valid values:

  • windows: Returns only capacity reservations for Windows.

  • linux: Returns only capacity reservations for Linux.

  • all: Returns all capacity reservations.

Default value: all.

linux

InstanceType

string

No

The instance type. You can use this parameter to query only active capacity reservations. To query released capacity reservations, you must specify PrivatePoolOptions.Ids.

ecs.c6.large

ZoneId

string

No

The zone ID of the capacity reservation.

cn-hangzhou-h

InstanceChargeType

string

No

The billing method of the instance. Valid values:

  • PostPaid: pay-as-you-go.

  • PrePaid: subscription.

Default value: PostPaid.

PostPaid

Status

string

No

The status of the capacity reservation. Valid values:

  • All: all statuses.

  • Pending: The capacity reservation is initializing. This is the initial status of a scheduled capacity reservation.

  • Preparing: The system is preparing resources for the scheduled capacity reservation.

  • Prepared: The resources are prepared, and the scheduled capacity reservation is waiting to take effect.

  • Active: The capacity reservation is active.

  • Released: The capacity reservation is released, either manually or automatically upon expiration.

If you do not specify this parameter, the operation returns capacity reservations in all states except Pending and Released.

Active

Response elements

Element

Type

Description

Example

object

NextToken

string

The token to retrieve the next page of results.

caeba0bbb2be03f84eb48b699f0a****

RequestId

string

The request ID.

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

TotalCount

integer

The total number of capacity reservations that match the query.

1

MaxResults

integer

The maximum number of entries returned per page.

10

CapacityReservationSet

object

CapacityReservationItem

array<object>

Details about the capacity reservations.

array<object>

The details of a capacity reservation.

Status

string

The status of the capacity reservation. Valid values:

  • Pending: The capacity reservation is being initialized.

  • Preparing: The capacity reservation is being prepared.

  • Prepared: The capacity reservation is ready to take effect.

  • Active: The capacity reservation is effective.

  • Released: The capacity reservation has been released, either manually or automatically upon expiration.

Active

TimeSlot

string

Note

This parameter is available by invitation only.

null

PrivatePoolOptionsMatchCriteria

string

The matching mode of the private pool generated by the capacity reservation. Valid values:

  • Open: The system automatically matches new instances to an open private pool. If no matching private pool is available, instances are launched using public pool resources.

  • Target: Instances must be explicitly launched into a specific private pool. The launch fails if the specified private pool is unavailable.

Open

PrivatePoolOptionsId

string

The ID of the capacity reservation.

crp-bp1gubrkqutenqdd****

PrivatePoolOptionsName

string

The name of the capacity reservation.

crpTestName

RegionId

string

The region ID of the capacity reservation.

cn-hangzhou

InstanceChargeType

string

The billing method for instances that use the capacity reservation. Valid values:

  • PostPaid: Pay-as-you-go

  • PrePaid: Subscription

PostPaid

EndTime

string

The time when the capacity reservation expires. This parameter is valid only when EndTimeType is set to Limited.

2021-02-19T03:02Z

StartTime

string

The time when the capacity reservation takes effect.

2021-02-19T02:01Z

Description

string

The description of the capacity reservation.

This is description.

EndTimeType

string

The release mode of the capacity reservation. Valid values:

  • Limited: The capacity reservation is automatically released at a specified time.

  • Unlimited: The capacity reservation must be manually released. It does not have an expiration time.

Unlimited

ResourceGroupId

string

The ID of the resource group to which the capacity reservation belongs.

rg-bp67acfmxazb4p****

Platform

string

The operating system for instances that can use the capacity reservation. Valid values:

  • windows

  • linux

linux

AllocatedResources

object

AllocatedResource

array<object>

Details about the allocated resources.

array<object>

The details of a resource allocation.

UsedAmount

integer

The number of reserved instances that are in use.

2

TotalAmount

integer

The total number of reserved instances of this instance type in this zone.

2

AvailableAmount

integer

The number of reserved instances that are still available.

2

FailedAmount

integer

1

LockedAmount

integer

1

zoneId

string

The zone ID.

cn-hangzhou-h

InstanceType

string

The instance type of the allocated resources.

ecs.c6.large

CapacityReservationUsages

object

CapacityReservationUsage

array<object>

The usage details of the capacity reservation, broken down by Alibaba Cloud account or service.

object

A usage summary.

AccountId

string

The ID of the Alibaba Cloud account that used the capacity reservation.

105909559088****

ServiceName

string

The name of the Alibaba Cloud service that used the capacity reservation.

maxcompute.aliyuncs.com

UsedAmount

integer

The number of instances used by the Alibaba Cloud account or service.

20

Tags

object

Tag

array<object>

The tags of the capacity reservation.

object

A tag of the capacity reservation.

TagValue

string

The tag value.

TestValue

TagKey

string

The tag key.

TestKey

StartTimeType

string

Indicates when the capacity reservation becomes effective. Valid values:

  • Now: The capacity reservation takes effect immediately after it is created.

  • Later: The capacity reservation takes effect at a specified time.

Now

SavingPlanId

string

The ID of the Savings Plan that is associated with the capacity reservation.

spn-c29b5e18pJMT****

ReservedInstanceId

string

The ID of the Reserved Instance that is associated with the capacity reservation.

ri-bpzhex2ulpzf53****

CapacityReservationOwnerId

string

The ID of the capacity reservation owner.

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

DeliveryTime

string

UnlockedTime

string

Examples

Success response

JSON format

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

Error codes

HTTP status code

Error code

Error message

Description

400 MissingParameter.RegionId The specified RegionId should not be null. The RegionId parameter is required.
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. The private pool does not support dedicated hosts.
400 SpotNotSupported Spot is not supported for PrivatePool. The private pool does not support spot instances.
400 ClassicNetworkNotSupported Classic network is not supported for PrivatePool. The private pool does not support instances in the classic network.
400 Invalid.InstanceId Instance does not exist. The specified instance does not exist.
400 Invalid.PrivatePoolOptions.MatchCriteria Target mode does not support this operation. The operation is not supported while the PrivatePoolOptions.MatchCriteria parameter is set to Target.
400 MissingParameter.PrivatePoolOptions.Id The specified PrivatePoolOptions.Id should not be null. The PrivatePoolOptions.Id parameter is required.
400 Invalid.PrivatePoolOptions.Id The PrivatePool does not exist. The private pool does not exist.
400 Invalid.InstanceType The InstanceType does not match the PrivatePool. The instance type and the private pool do not match.
400 Invalid.InstanceChargeType The InstanceChargeType does not match the PrivatePool. The instance billing method and the private pool do not match.
400 Invalid.ZoneId The ZoneId does not match the PrivatePool. The zone and the private pool do not match.
400 Invalid.PrivatePoolOptions.status The PrivatePool has been used up. The resource is exhausted.
400 InvalidPlatform.ValueNotSupported The Platform does not match the PrivatePool. The specified Platform parameter does not match the private pool.
400 InvalidAliUid The PrivatePool does not belong to the user of the Instance. The specified private pool does not belong to the user who attempted to create the instance.
400 MissingParameter.PackageType The specified parameter "PackageType" can not be empty.
400 MissingParameter.PrivatePoolOptions.Ids The specified parameter "PrivatePoolOptions.Ids" can not be empty. Specifies that the parameter "PrivatePoolOptions.ids" cannot be empty.
400 MissingParameter.InstanceCpuCoreCount The specified parameter "InstanceCpuCoreCount" can not be empty. The specified parameter 'InstanceCpuCocount' cannot be empty.
400 MissingParameter.InstanceAmount The specified parameter "InstanceAmount" can not be empty. The specified parameter InstanceAmount cannot be empty.
400 MissingParameter.InstanceCpuCoreCountOrInstanceAmount The specified parameter "InstanceCpuCoreCount" and "InstanceAmount" must not be empty at the same time. The specified parameter InstanceCpuCoreCount and InstanceAmount cannot be both empty.
400 Invalid.TooManyPrivatePoolOptions.Ids Too many PrivatePoolOptions.Ids in this request. The number of specified private pool IDs exceeds the upper limit.
400 Invalid.TooManyZoneIds Too many ZoneIds in the request. The number of specified zone IDs exceeds the upper limit.
400 Invalid.TooManyInstanceTypes Too many InstanceTypes in the request. The number of specified instance types exceeds the upper limit.
400 Invalid.TooManyUnpaidPrivatePool Too many PrivatePools create but still unpaid. Multiple private pools are created but not paid.
400 Invalid.InstanceCpuCoreCountOrInstanceAmount Both InstanceCpuCoreCount and InstanceAmount are provided. The InstanceCpuCoreCount and InstanceAmount parameters cannot be both specified.
400 Invalid.PrivatePoolOptions.Ids The specified parameter "PrivatePoolOptions.Ids" exist invalid element Id. The specified private pool ID does not exist.
400 Invalid.PackageType The specified parameter "PackageType" is invalid. The specified parameter PackageType is invalid.
400 Invalid.PrivatePool.Purchase The PrivatePool has already paid. The private pool is already paid.
400 Invalid.AssuranceTimes.NotSupported The value of AssuranceTimes is not supported. The specified AssuranceTimes parameter is invalid.
400 RepeatStartPrivatePool PrivatePool has already been started. The private pool is already 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. The current resource is bound to a sharing relationship and cannot be released.
500 InternalError The request processing has failed due to some unknown error, exception or failure. An internal error has occurred. Try again later.

See Error Codes for a complete list.

Release notes

See Release Notes for a complete list.