All Products
Search
Document Center

Elastic Compute Service:DescribeCapacityReservations

Last Updated:Apr 11, 2024

Queries the details of capacity reservations.

Debugging

OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer.

Authorization information

There is currently no authorization information disclosed in the API.

Request parameters

ParameterTypeRequiredDescriptionExample
RegionIdstringYes

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

cn-hangzhou
ResourceGroupIdstringNo

The ID of the resource group to which the capacity reservation belongs. If you specify this parameter 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 whether you specify this parameter.
rg-bp67acfmxazb4p****
Tagobject []No

The tags.

KeystringNo

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

If you specify a single tag to query resources, up to 1,000 resources with this tag are returned in the response. If you specify multiple tags to query resources, up to 1,000 resources with all these tags are 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. Valid values of N: 1 to 20.

TestValue
MaxResultsintegerNo

The number of entries per page.

Valid values: 1 to 100

Default value: 10.

10
NextTokenstringNo

The pagination token that is used in the next request to retrieve a new page of results. You must specify the token that is obtained from the previous query as the value of the NextToken parameter.

caeba0bbb2be03f84eb48b699f0a4883
PrivatePoolOptions.IdsstringNo

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 (,).

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

The operating system of the instance. Valid values:

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

Default value: all.

linux
InstanceTypestringNo

The instance type.

ecs.c6.large
ZoneIdstringNo

The zone ID of the capacity reservation.

cn-hangzhou-h
InstanceChargeTypestringNo

The billing method of the instance. Valid values:

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

Default value: PostPaid.

PostPaid
StatusstringNo

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.

Active

Response parameters

ParameterTypeDescriptionExample
object
NextTokenstring

A pagination token. It can be used in the next request to retrieve a new page of results.If NextToken is empty, no next page exists.

caeba0bbb2be03f84eb48b699f0a****
RequestIdstring

The request ID.

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

The total number of entries returned.

1
MaxResultsinteger

The maximum number of entries returned per page.

10
CapacityReservationSetobject []

Details of the capacity reservations.

Statusstring

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.
Active
TimeSlotstring
Note This parameter is in invitational preview and is not publicly available.
null
PrivatePoolOptionsMatchCriteriastring

The type of the private pool generated after the capacity reservation takes effect. Valid values:

  • Open: open private pool.
  • Target: targeted private pool.
Open
PrivatePoolOptionsIdstring

The ID of the capacity reservation.

crp-bp1gubrkqutenqdd****
PrivatePoolOptionsNamestring

The name of the capacity reservation.

crpTestName
RegionIdstring

The region ID of the capacity reservation.

cn-hangzhou
InstanceChargeTypestring

The billing method of instances in the capacity reservation. Valid values:

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

The time when the capacity reservation expires.

2021-02-19T03:02Z
StartTimestring

The time when the capacity reservation takes effect.

2021-02-19T02:01Z
Descriptionstring

The description of the capacity reservation.

This is description.
EndTimeTypestring

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 the capacity reservation anytime.
Unlimited
ResourceGroupIdstring

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

rg-bp67acfmxazb4p****
Platformstring

The operating system type of the instances. Valid values:

  • windows: Windows operating systems.
  • linux: Linux operating systems.
linux
AllocatedResourcesobject []

Details of the allocated resources.

UsedAmountinteger

The number of instances that have used the capacity reservation.

2
TotalAmountinteger

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

2
zoneIdstring

The zone ID.

cn-hangzhou-h
InstanceTypestring

The instance type.

ecs.c6.large
Tagsobject []

The tags of the capacity reservation.

TagValuestring

The value of the tag.

TestValue
TagKeystring

The key of the tag.

TestKey
StartTimeTypestring

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.
Now
SavingPlanIdstring

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

spn-c29b5e18pJMT****
ReservedInstanceIdstring

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

ri-bpzhex2ulpzf53****

Examples

Sample success responses

JSONformat

{
  "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,
              "zoneId": "cn-hangzhou-h",
              "InstanceType": "ecs.c6.large"
            }
          ]
        },
        "Tags": {
          "Tag": [
            {
              "TagValue": "TestValue",
              "TagKey": "TestKey"
            }
          ]
        },
        "StartTimeType": "Now",
        "SavingPlanId": "spn-c29b5e18pJMT****",
        "ReservedInstanceId": "ri-bpzhex2ulpzf53****"
      }
    ]
  }
}

Error codes

HTTP status codeError codeError messageDescription
400MissingParameter.RegionIdThe specified RegionId should not be null.The RegionId parameter is required.
400InvalidParameter.NameThe specified PrivatePoolOptions.Name is invalid.-
400InvalidParameter.PrivatePoolOptions.IdsThe specified PrivatePoolOptions.Ids is invalid.-
400DedicatedHostNotSupportedDedicatedHost is not supported for PrivatePool.The private pool does not support dedicated hosts.
400SpotNotSupportedSpot is not supported for PrivatePool.The private pool does not support preemptible instances.
400ClassicNetworkNotSupportedClassic network is not supported for PrivatePool.The private pool does not support instances in the classic network.
400Invalid.InstanceIdInstance does not exist.The specified instance does not exist.
400Invalid.PrivatePoolOptions.MatchCriteriaTarget mode does not support this operation.The operation is not supported while the PrivatePoolOptions.MatchCriteria parameter is set to Target.
400MissingParameter.PrivatePoolOptions.IdThe specified PrivatePoolOptions.Id should not be null.The PrivatePoolOptions.Id parameter is required.
400Invalid.PrivatePoolOptions.IdThe PrivatePool does not exist.The private pool does not exist.
400Invalid.InstanceTypeThe InstanceType does not match the PrivatePool.The instance type and the private pool do not match.
400Invalid.InstanceChargeTypeThe InstanceChargeType does not match the PrivatePool.The instance billing method and the private pool do not match.
400Invalid.ZoneIdThe ZoneId does not match the PrivatePool.The zone and the private pool do not match.
400Invalid.PrivatePoolOptions.statusThe PrivatePool has been used up.-
400Invalid.PrivatePoolOptions.MatchCriteriaThe PrivatePoolOptions.MatchCriteria does not match the PrivatePool.The specified PrivatePoolOptions.MatchCriteria parameter does not match the private pool.
400InvalidPlatform.ValueNotSupportedThe Platform does not match the PrivatePool.The specified Platform parameter does not match the private pool.
400Invalid.PrivatePoolOptions.statusThe PrivatePool is expired or inactive.-
400Invalid.PrivatePoolOptions.statusThe PrivatePool status is not valid.-
400Invalid.PrivatePoolOptions.statusThe Instance should be created within 48 hours once the PrivatePool is started.-
400InvalidAliUidThe 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.
400Invalid.InstanceIdThe Instance dose not attached to a PrivatePool.The instance and the private pool do not match.
400MissingParameter.PackageTypeThe specified parameter "PackageType" can not be empty.-
400MissingParameter.PrivatePoolOptions.IdsThe specified parameter "PrivatePoolOptions.Ids" can not be empty.-
400MissingParameter.PrivatePoolOptions.IdThe specified parameter "PrivatePoolOptions.Id" can not be empty.-
400MissingParameter.InstanceCpuCoreCountThe specified parameter "InstanceCpuCoreCount" can not be empty.-
400MissingParameter.InstanceAmountThe specified parameter "InstanceAmount" can not be empty.-
400MissingParameter.InstanceCpuCoreCountOrInstanceAmountThe specified parameter "InstanceCpuCoreCount" and "InstanceAmount" must not be empty at the same time.-
400Invalid.TooManyPrivatePoolOptions.IdsToo many PrivatePoolOptions.Ids in this request.The number of specified private pool IDs exceeds the upper limit.
400Invalid.TooManyZoneIdsToo many ZoneIds in the request.The number of specified zone IDs exceeds the upper limit.
400Invalid.TooManyInstanceTypesToo many InstanceTypes in the request.The number of specified instance types exceeds the upper limit.
400Invalid.TooManyUnpaidPrivatePoolToo many PrivatePools create but still unpaid.Multiple private pools are created but not paid.
400Invalid.InstanceCpuCoreCountOrInstanceAmountBoth InstanceCpuCoreCount and InstanceAmount are provided.The InstanceCpuCoreCount and InstanceAmount parameters cannot be both specified.
400Invalid.PrivatePoolOptions.IdsThe specified parameter "PrivatePoolOptions.Ids" exist invalid element Id.-
400Invalid.PackageTypeThe specified parameter "PackageType" is invalid.-
400Invalid.PrivatePool.PurchaseThe PrivatePool has already paid.The private pool is already paid.
400Invalid.AssuranceTimes.NotSupportedThe value of AssuranceTimes is not supported.The specified AssuranceTimes parameter is invalid.
400Invalid.TooManyInstanceTypesThe specified parameter "InstanceType" should only has one item.-
400Invalid.PrivatePoolOptions.MatchCriteriaThe specified parameter "PrivatePoolOptions.MatchCriteria" is invalid.-
400RepeatStartPrivatePoolPrivatePool has already been started.The private pool is already started.
400Invalid.PrivatePoolOptions.IdThe specified parameter "PrivatePoolOptions.Id" should be empty.-
400Invalid.InstanceIdModify DedicatedHost Instance's attachment attributes is not supported.-
400Invalid.InstanceIdModify Spot Instance's attachment attributes is not supported.-
400Invalid.InstanceIdModify Classic Network Instance's attachment attributes is not supported.-
400InvalidParameter.RegionIdThe specified RegionId is not exist.The specified RegionId parameter does not exist.
500InternalErrorThe request processing has failed due to some unknown error, exception or failure.An internal error has occurred. Try again later.

For a list of error codes, visit the Service error codes.

Change history

Change timeSummary of changesOperation
2023-12-07The Error code has changed. The response structure of the API has changedsee changesets
Change itemChange content
Error CodesThe Error code has changed.
    Error Codes 400 change
    delete Error Codes: 500
Output ParametersThe response structure of the API has changed.
2021-06-18The Error code has changed. The response structure of the API has changedsee changesets
Change itemChange content
Error CodesThe Error code has changed.
    delete Error Codes: 400
    delete Error Codes: 500
Output ParametersThe response structure of the API has changed.