- 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.
PurchaseCapacityBlockExtensionCommand
Purchase the Capacity Block extension for use with your account. You must specify the ID of the Capacity Block extension offering you are purchasing.
Example Syntax
Use a bare-bones client and the command you need to make an API call.
import { EC2Client, PurchaseCapacityBlockExtensionCommand } from "@aws-sdk/client-ec2"; // ES Modules import
// const { EC2Client, PurchaseCapacityBlockExtensionCommand } = require("@aws-sdk/client-ec2"); // CommonJS import
const client = new EC2Client(config);
const input = { // PurchaseCapacityBlockExtensionRequest
CapacityBlockExtensionOfferingId: "STRING_VALUE", // required
CapacityReservationId: "STRING_VALUE", // required
DryRun: true || false,
};
const command = new PurchaseCapacityBlockExtensionCommand(input);
const response = await client.send(command);
// { // PurchaseCapacityBlockExtensionResult
// CapacityBlockExtensions: [ // CapacityBlockExtensionSet
// { // CapacityBlockExtension
// CapacityReservationId: "STRING_VALUE",
// InstanceType: "STRING_VALUE",
// InstanceCount: Number("int"),
// AvailabilityZone: "STRING_VALUE",
// AvailabilityZoneId: "STRING_VALUE",
// CapacityBlockExtensionOfferingId: "STRING_VALUE",
// CapacityBlockExtensionDurationHours: Number("int"),
// CapacityBlockExtensionStatus: "payment-pending" || "payment-failed" || "payment-succeeded",
// CapacityBlockExtensionPurchaseDate: new Date("TIMESTAMP"),
// CapacityBlockExtensionStartDate: new Date("TIMESTAMP"),
// CapacityBlockExtensionEndDate: new Date("TIMESTAMP"),
// UpfrontFee: "STRING_VALUE",
// CurrencyCode: "STRING_VALUE",
// },
// ],
// };
PurchaseCapacityBlockExtensionCommand Input
See PurchaseCapacityBlockExtensionCommandInput for more details
Parameter | Type | Description |
---|
Parameter | Type | Description |
---|---|---|
CapacityBlockExtensionOfferingId Required | string | undefined | The ID of the Capacity Block extension offering to purchase. |
CapacityReservationId Required | string | undefined | The ID of the Capacity reservation to be extended. |
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 |
PurchaseCapacityBlockExtensionCommand Output
See PurchaseCapacityBlockExtensionCommandOutput for details
Parameter | Type | Description |
---|
Parameter | Type | Description |
---|---|---|
$metadata Required | ResponseMetadata | Metadata pertaining to this request. |
CapacityBlockExtensions | CapacityBlockExtension[] | undefined | The purchased Capacity Block extensions. |
Throws
Name | Fault | Details |
---|
Name | Fault | Details |
---|---|---|
EC2ServiceException | Base exception class for all service exceptions from EC2 service. |