DescribeCapacityBlockOfferingsCommand

Describes Capacity Block offerings available for purchase in the Amazon Web Services Region that you're currently using. With Capacity Blocks, you purchase a specific instance type for a period of time.

Example Syntax

Use a bare-bones client and the command you need to make an API call.

import { EC2Client, DescribeCapacityBlockOfferingsCommand } from "@aws-sdk/client-ec2"; // ES Modules import
// const { EC2Client, DescribeCapacityBlockOfferingsCommand } = require("@aws-sdk/client-ec2"); // CommonJS import
const client = new EC2Client(config);
const input = { // DescribeCapacityBlockOfferingsRequest
  DryRun: true || false,
  InstanceType: "STRING_VALUE",
  InstanceCount: Number("int"),
  StartDateRange: new Date("TIMESTAMP"),
  EndDateRange: new Date("TIMESTAMP"),
  CapacityDurationHours: Number("int"), // required
  NextToken: "STRING_VALUE",
  MaxResults: Number("int"),
};
const command = new DescribeCapacityBlockOfferingsCommand(input);
const response = await client.send(command);
// { // DescribeCapacityBlockOfferingsResult
//   CapacityBlockOfferings: [ // CapacityBlockOfferingSet
//     { // CapacityBlockOffering
//       CapacityBlockOfferingId: "STRING_VALUE",
//       InstanceType: "STRING_VALUE",
//       AvailabilityZone: "STRING_VALUE",
//       InstanceCount: Number("int"),
//       StartDate: new Date("TIMESTAMP"),
//       EndDate: new Date("TIMESTAMP"),
//       CapacityBlockDurationHours: Number("int"),
//       UpfrontFee: "STRING_VALUE",
//       CurrencyCode: "STRING_VALUE",
//       Tenancy: "default" || "dedicated",
//       CapacityBlockDurationMinutes: Number("int"),
//     },
//   ],
//   NextToken: "STRING_VALUE",
// };

DescribeCapacityBlockOfferingsCommand Input

Parameter
Type
Description
CapacityDurationHours
Required
number | undefined

The number of hours for which to reserve Capacity Block.

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 DryRunOperation. Otherwise, it is UnauthorizedOperation.

EndDateRange
Date | undefined

The latest end date for the Capacity Block offering.

InstanceCount
number | undefined

The number of instances for which to reserve capacity.

InstanceType
string | undefined

The type of instance for which the Capacity Block offering reserves capacity.

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.

StartDateRange
Date | undefined

The earliest start date for the Capacity Block offering.

DescribeCapacityBlockOfferingsCommand Output

Parameter
Type
Description
$metadata
Required
ResponseMetadata
Metadata pertaining to this request.
CapacityBlockOfferings
CapacityBlockOffering[] | undefined

The recommended Capacity Block offering for the dates specified.

NextToken
string | undefined

The token to use to retrieve the next page of results. This value is null when there are no more results to return.

Throws

Name
Fault
Details
EC2ServiceException
Base exception class for all service exceptions from EC2 service.