- Navigation GuideYou are on a Command (operation) page with structural examples. Use the navigation breadcrumb if you would like to return to the Client landing page.
DescribeCapacityReservationsCommand
Describes one or more of your Capacity Reservations. The results describe only the Capacity Reservations in the Amazon Web Services Region that you're currently using.
Example Syntax
Use a bare-bones client and the command you need to make an API call.
import { EC2Client, DescribeCapacityReservationsCommand } from "@aws-sdk/client-ec2"; // ES Modules import
// const { EC2Client, DescribeCapacityReservationsCommand } = require("@aws-sdk/client-ec2"); // CommonJS import
const client = new EC2Client(config);
const input = { // DescribeCapacityReservationsRequest
CapacityReservationIds: [ // CapacityReservationIdSet
"STRING_VALUE",
],
NextToken: "STRING_VALUE",
MaxResults: Number("int"),
Filters: [ // FilterList
{ // Filter
Name: "STRING_VALUE",
Values: [ // ValueStringList
"STRING_VALUE",
],
},
],
DryRun: true || false,
};
const command = new DescribeCapacityReservationsCommand(input);
const response = await client.send(command);
// { // DescribeCapacityReservationsResult
// NextToken: "STRING_VALUE",
// CapacityReservations: [ // CapacityReservationSet
// { // CapacityReservation
// CapacityReservationId: "STRING_VALUE",
// OwnerId: "STRING_VALUE",
// CapacityReservationArn: "STRING_VALUE",
// AvailabilityZoneId: "STRING_VALUE",
// InstanceType: "STRING_VALUE",
// InstancePlatform: "Linux/UNIX" || "Red Hat Enterprise Linux" || "SUSE Linux" || "Windows" || "Windows with SQL Server" || "Windows with SQL Server Enterprise" || "Windows with SQL Server Standard" || "Windows with SQL Server Web" || "Linux with SQL Server Standard" || "Linux with SQL Server Web" || "Linux with SQL Server Enterprise" || "RHEL with SQL Server Standard" || "RHEL with SQL Server Enterprise" || "RHEL with SQL Server Web" || "RHEL with HA" || "RHEL with HA and SQL Server Standard" || "RHEL with HA and SQL Server Enterprise" || "Ubuntu Pro",
// AvailabilityZone: "STRING_VALUE",
// Tenancy: "default" || "dedicated",
// TotalInstanceCount: Number("int"),
// AvailableInstanceCount: Number("int"),
// EbsOptimized: true || false,
// EphemeralStorage: true || false,
// State: "active" || "expired" || "cancelled" || "pending" || "failed" || "scheduled" || "payment-pending" || "payment-failed" || "assessing" || "delayed" || "unsupported",
// StartDate: new Date("TIMESTAMP"),
// EndDate: new Date("TIMESTAMP"),
// EndDateType: "unlimited" || "limited",
// InstanceMatchCriteria: "open" || "targeted",
// CreateDate: new Date("TIMESTAMP"),
// Tags: [ // TagList
// { // Tag
// Key: "STRING_VALUE",
// Value: "STRING_VALUE",
// },
// ],
// OutpostArn: "STRING_VALUE",
// CapacityReservationFleetId: "STRING_VALUE",
// PlacementGroupArn: "STRING_VALUE",
// CapacityAllocations: [ // CapacityAllocations
// { // CapacityAllocation
// AllocationType: "used" || "future",
// Count: Number("int"),
// },
// ],
// ReservationType: "default" || "capacity-block",
// UnusedReservationBillingOwnerId: "STRING_VALUE",
// CommitmentInfo: { // CapacityReservationCommitmentInfo
// CommittedInstanceCount: Number("int"),
// CommitmentEndDate: new Date("TIMESTAMP"),
// },
// DeliveryPreference: "fixed" || "incremental",
// },
// ],
// };
DescribeCapacityReservationsCommand Input
Parameter | Type | Description |
---|
Parameter | Type | Description |
---|---|---|
CapacityReservationIds | string[] | undefined | The ID of the Capacity Reservation. |
DryRun | boolean | undefined | Checks whether you have the required permissions for the action, without actually making the request, and provides an error response. If you have the required permissions, the error response is |
Filters | Filter[] | undefined | One or more filters.
|
MaxResults | number | undefined | The maximum number of items to return for this request. To get the next page of items, make another request with the token returned in the output. For more information, see Pagination . |
NextToken | string | undefined | The token to use to retrieve the next page of results. |
DescribeCapacityReservationsCommand Output
Parameter | Type | Description |
---|
Parameter | Type | Description |
---|---|---|
$metadata Required | ResponseMetadata | Metadata pertaining to this request. |
CapacityReservations | CapacityReservation[] | undefined | Information about the Capacity Reservations. |
NextToken | string | undefined | The token to use to retrieve the next page of results. This value is |
Throws
Name | Fault | Details |
---|
Name | Fault | Details |
---|---|---|
EC2ServiceException | Base exception class for all service exceptions from EC2 service. |