Queries the details of one or more capacity reservations.

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 DescribeCapacityReservations

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

RegionId String Yes cn-hangzhou

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

ResourceGroupId String No rg-bp67acfmxazb4p****

The ID of the resource group to which the capacity reservation belongs. If this parameter is specified to query resources, up to 1,000 resources that belong to the specified resource group can be displayed in the response.

Note Resources in the default resource group are displayed in the response regardless of how this parameter is set.
Tag.N.Key String No TestKey

The key of tag N of the capacity reservation. Valid values of N: 1 to 20.

If a single tag is specified to query resources, up to 1,000 resources that have this tag added can be displayed in the response. If multiple tags are specified to query resources, up to 1,000 resources that have all these tags added can be displayed in the response. To query more than 1,000 resources that have specified tags added, call the ListTagResources operation.

Tag.N.Value String No TestValue

The value of tag N of the capacity reservation. Valid values of N: 1 to 20.

MaxResults Integer No 10

The maximum number of entries to return on each page.

Maximum value: 100.

Default value: 10.

NextToken String No caeba0bbb2be03f84eb48b699f0a4883

The token used to start the next query. Set the value to the NextToken value obtained from the response to the previous request.

PrivatePoolOptions.Ids String No ["crp-bp1gubrkqutenqdd****", "crp-bp67acfmxazb5****"]

The IDs of capacity reservations. The value can be a JSON array that consists of up to 100 capacity reservation IDs. Separate the IDs with commas (,).

Platform String No linux

The operating system type of instances to be created by using the capacity reservation. Valid values:

  • windows: Windows operating systems
  • linux: Linux operating systems
  • all: all operating system types

Default value: all.

InstanceType String No ecs.c6.large

The instance type.

ZoneId String No cn-hangzhou-h

The zone ID of the capacity reservation.

InstanceChargeType String No PostPaid

The billing method of instances to be created by using the capacity reservation. Valid values:

  • PostPaid: pay-as-you-go
  • PrePaid: subscription

Default value: PostPaid.

Status String No Active

The state of the capacity reservation. Valid values:

  • All: All states.
  • Pending: The capacity reservation is being initialized. Scheduled capacity reservations enter the Pending state after they are created.
  • Preparing: The capacity reservation is being prepared. Scheduled capacity reservations are in the Preparing state while resources are being provisioned.
  • Prepared: The capacity reservation is to take effect. After resources are provisioned, scheduled capacity reservations remain in the Prepared state until they take effect.
  • Active: The capacity reservation is in effect.
  • Released: The capacity reservation has been released manually or automatically when it expired.

Default value: Active.

Response parameters

Parameter Type Example Description
NextToken String caeba0bbb2be03f84eb48b699f0a****

The token used to start the next query.

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

The ID of the request.

TotalCount Integer 1

The total number of entries returned.

MaxResults Integer 10

The maximum number of entries returned per page.

CapacityReservationSet Array of CapacityReservationItem

Details about the capacity reservations.

CapacityReservationItem
Status String Active

The state 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 to take effect.
  • Active: The capacity reservation is in effect.
  • Released: The capacity reservation has been released manually or automatically when it expired.
TimeSlot String null
Note This parameter is currently in invitational preview and unavailable for general users.
PrivatePoolOptionsMatchCriteria String Open

The type of the private pool associated with the capacity reservation. Valid values:

  • Open: open private pool
  • Target: targeted private pool
PrivatePoolOptionsId String crp-bp1gubrkqutenqdd****

The ID of the capacity reservation.

PrivatePoolOptionsName String crpTestName

The name of the capacity reservation.

RegionId String cn-hangzhou

The region ID of the capacity reservation.

InstanceChargeType String PostPaid

The billing method of instances to be created by using the capacity reservation. Valid values:

  • PostPaid: pay-as-you-go
  • PrePaid: subscription
EndTime String 2021-02-19T03:02Z

The time when the capacity reservation expires.

StartTime String 2021-02-19T02:01Z

The time when the capacity reservation takes effect.

Description String This is description.

The description of the capacity reservation.

EndTimeType String Unlimited

The release mode of the capacity reservation. Valid values:

  • Limited: The capacity reservation is automatically released at the specified time.
  • Unlimited: The capacity reservation is manually released. You can release it anytime.
ResourceGroupId String rg-bp67acfmxazb4p****

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

Platform String linux

The operating system type of instances to be created by using the capacity reservation. Valid values:

  • windows
  • linux
AllocatedResources Array of AllocatedResource

Details about the allocated resources.

AllocatedResource
UsedAmount Integer 2

The number of instances that have used the capacity reservation.

TotalAmount Integer 2

The total number of instances for which capacity of an instance type is reserved.

zoneId String cn-hangzhou-h

The zone ID.

InstanceType String ecs.c6.large

The instance type.

Tags Array of Tag

The tags of the capacity reservation.

Tag
TagValue String TestValue

The tag value of the capacity reservation.

TagKey String TestKey

The tag key of the capacity reservation.

StartTimeType String Now

The mode in which the capacity reservation takes effect. Valid values:

  • Now: The capacity reservation takes effect as soon as it is created.
  • Later: The capacity reservation takes effect at the specified time.
SavingPlanId String spn-c29b5e18pJMT****

The ID of the savings plan used with the capacity reservation.

ReservedInstanceId String ri-bpzhex2ulpzf53****

The ID of the reserved instance used with the capacity reservation.

Examples

Sample requests

http(s)://ecs.aliyuncs.com/?Action=DescribeCapacityReservations
&RegionId=cn-hangzhou
&PrivatePoolOptions.Ids=["crp-bp1gubrkqutenqdd****", "crp-bp67acfmxazb5****"]
&InstanceType=ecs.c6.large
&<Common request parameters>

Sample success responses

XML format

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

<DescribeCapacityReservationsResponse>
    <TotalCount>1</TotalCount>
    <NextToken>caeba0bbb2be03f84eb48b699f0a****</NextToken>
    <RequestId>473469C7-AA6F-4DC5-B3DB-A3DC0DE3****</RequestId>
    <MaxResults>10</MaxResults>
    <CapacityReservationSet>
        <CapacityReservationItem>
            <Status>Active</Status>
            <Description>This is description.</Description>
            <EndTime>2021-02-19T03:02Z</EndTime>
            <Platform>linux</Platform>
            <ResourceGroupId>rg-bp67acfmxazb4p****</ResourceGroupId>
            <PrivatePoolOptionsName>crpTestName</PrivatePoolOptionsName>
            <InstanceChargeType>PostPaid</InstanceChargeType>
            <StartTime>2021-02-19T02:01Z</StartTime>
            <StartTimeType>Now</StartTimeType>
            <PrivatePoolOptionsMatchCriteria>Open</PrivatePoolOptionsMatchCriteria>
            <TimeSlot/>
            <SavingPlanId>spn-c29b5e18pJMT****</SavingPlanId>
            <ReservedInstanceId>ri-bpzhex2ulpzf53****</ReservedInstanceId>
            <AllocatedResources>
                <AllocatedResource>
                    <UsedAmount>2</UsedAmount>
                    <zoneId>cn-hangzhou-h</zoneId>
                    <TotalAmount>2</TotalAmount>
                    <InstanceType>ecs.c6.large</InstanceType>
                </AllocatedResource>
            </AllocatedResources>
            <PrivatePoolOptionsId>crp-bp1gubrkqutenqdd****</PrivatePoolOptionsId>
            <EndTimeType>Unlimited</EndTimeType>
            <RegionId>cn-hangzhou</RegionId>
            <Tags>
                <Tag>
                    <TagKey>TestKey</TagKey>
                    <TagValue>TestValue</TagValue>
                </Tag>
            </Tags>
        </CapacityReservationItem>
    </CapacityReservationSet>
</DescribeCapacityReservationsResponse>

JSON format

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

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

Error codes

HTTP status code Error code Error message Description
400 MissingParameter.RegionId The specified RegionId should not be null. The error message returned because the required RegionId parameter is not specified.
400 DedicatedHostNotSupported DedicatedHost is not supported for PrivatePool. The error message returned because private pools cannot be used to create instances on dedicated hosts.
400 SpotNotSupported Spot is not supported for PrivatePool. The error message returned because private pools cannot be used to create preemptible instances.
400 ClassicNetworkNotSupported Classic network is not supported for PrivatePool. The error message returned because private pools cannot be used to create instances in the classic network.
400 Invalid.InstanceId Instance does not exist. The error message returned because the instance does not exist.
400 Invalid.PrivatePoolOptions.MatchCriteria Target mode does not support this operation. The error message returned because targeted private pools do not support the operation.
400 MissingParameter.PrivatePoolOptions.Id The specified PrivatePoolOptions.Id should not be null. The error message returned because the PrivatePoolOptions.Ids parameter is not specified.
400 Invalid.PrivatePoolOptions.Id The PrivatePool does not exist. The error message returned because the private pool does not exist.
400 Invalid.InstanceType The InstanceType does not match the PrivatePool. The error message returned because the instance type does not match the private pool.
400 Invalid.InstanceChargeType The InstanceChargeType does not match the PrivatePool. The error message returned because the private pool cannot be used to create instances that use the specified billing method.
400 Invalid.ZoneId The ZoneId does not match the PrivatePool. The error message returned because the zone does not match the private pool.
400 Invalid.PrivatePoolOptions.MatchCriteria The PrivatePoolOptions.MatchCriteria does not match the PrivatePool. The error message returned because the specified PrivatePoolOptions.MatchCriteria parameter does not match the private pool.
400 InvalidPlatform.ValueNotSupported The Platform does not match the PrivatePool. The error message returned because the specified Platform parameter does not match the private pool.
400 InvalidAliUid The PrivatePool does not belong to the user of the Instance. The error message returned because the private pool does not belong to the user who attempted to create the instance.
400 Invalid.InstanceId The Instance dose not attached to a PrivatePool. The error message returned because the instance does not match the private pool.
400 Invalid.TooManyPrivatePoolOptions.Ids Too many PrivatePoolOptions.Ids in this request. The error message returned because the number of specified capacity reservation IDs exceeds the upper limit.
400 Invalid.TooManyZoneIds Too many ZoneIds in the request. The error message returned because the number of specified zone IDs exceeds the upper limit.
400 Invalid.TooManyInstanceTypes Too many InstanceTypes in the request. The error message returned because the number of specified instance types exceeds the upper limit.
400 Invalid.TooManyUnpaidPrivatePool Too many PrivatePools create but still unpaid. The error message returned because multiple private pools are created and not paid.
400 Invalid.InstanceCpuCoreCountOrInstanceAmount Both InstanceCpuCoreCount and InstanceAmount are provided. The error message returned because the InstanceCpuCoreCount and InstanceAmount parameters cannot be specified at the same time.
400 Invalid.PrivatePool.Purchase The PrivatePool has already paid. The error message returned because the private pool is already paid.
400 Invalid.AssuranceTimes.NotSupported The value of AssuranceTimes is not supported. The error message returned because the specified AssuranceTimes parameter is invalid.
400 RepeatStartPrivatePool PrivatePool has already been started. The error message returned because the private pool is already started.
400 InvalidParameter.RegionId The specified RegionId is not exist. The error message returned because the specified RegionId parameter does not exist.
500 InternalError The request processing has failed due to some unknown error, exception or failure. The error message returned because an internal error has occurred. Try again later.

For a list of error codes, visit the API Error Center.