Use DescribeCapacityReservations
with a CLI
The following code examples show how to use DescribeCapacityReservations
.
- CLI
-
- AWS CLI
-
Example 1: To describe one or more of your capacity reservations
The following
describe-capacity-reservations
example displays details about all of your capacity reservations in the current AWS Region.aws ec2 describe-capacity-reservations
Output:
{ "CapacityReservations": [ { "CapacityReservationId": "cr-1234abcd56EXAMPLE ", "EndDateType": "unlimited", "AvailabilityZone": "eu-west-1a", "InstanceMatchCriteria": "open", "Tags": [], "EphemeralStorage": false, "CreateDate": "2019-08-16T09:03:18.000Z", "AvailableInstanceCount": 1, "InstancePlatform": "Linux/UNIX", "TotalInstanceCount": 1, "State": "active", "Tenancy": "default", "EbsOptimized": true, "InstanceType": "a1.medium" }, { "CapacityReservationId": "cr-abcdEXAMPLE9876ef ", "EndDateType": "unlimited", "AvailabilityZone": "eu-west-1a", "InstanceMatchCriteria": "open", "Tags": [], "EphemeralStorage": false, "CreateDate": "2019-08-07T11:34:19.000Z", "AvailableInstanceCount": 3, "InstancePlatform": "Linux/UNIX", "TotalInstanceCount": 3, "State": "cancelled", "Tenancy": "default", "EbsOptimized": true, "InstanceType": "m5.large" } ] }
Example 2: To describe one or more of your capacity reservations
The following
describe-capacity-reservations
example displays details about the specified capacity reservation.aws ec2 describe-capacity-reservations \ --capacity-reservation-ids
cr-1234abcd56EXAMPLE
Output:
{ "CapacityReservations": [ { "CapacityReservationId": "cr-1234abcd56EXAMPLE", "EndDateType": "unlimited", "AvailabilityZone": "eu-west-1a", "InstanceMatchCriteria": "open", "Tags": [], "EphemeralStorage": false, "CreateDate": "2019-08-16T09:03:18.000Z", "AvailableInstanceCount": 1, "InstancePlatform": "Linux/UNIX", "TotalInstanceCount": 1, "State": "active", "Tenancy": "default", "EbsOptimized": true, "InstanceType": "a1.medium" } ] }
For more information, see Viewing a Capacity Reservation in the Amazon Elastic Compute Cloud User Guide for Linux Instances.
-
For API details, see DescribeCapacityReservations
in AWS CLI Command Reference.
-
- PowerShell
-
- Tools for PowerShell
-
Example 1: This example describes one or more of your Capacity Reservations for the region
Get-EC2CapacityReservation -Region eu-west-1
Output:
AvailabilityZone : eu-west-1b AvailableInstanceCount : 2 CapacityReservationId : cr-0c1f2345db6f7cdba CreateDate : 3/28/2019 9:29:41 AM EbsOptimized : True EndDate : 1/1/0001 12:00:00 AM EndDateType : unlimited EphemeralStorage : False InstanceMatchCriteria : open InstancePlatform : Windows InstanceType : m4.xlarge State : active Tags : {} Tenancy : default TotalInstanceCount : 2
-
For API details, see DescribeCapacityReservations in AWS Tools for PowerShell Cmdlet Reference.
-
For a complete list of AWS SDK developer guides and code examples, see Create Amazon EC2 resources using an AWS SDK. This topic also includes information about getting started and details about previous SDK versions.