@pulumi/aws
Version:
A Pulumi package for creating and managing Amazon Web Services (AWS) cloud resources.
120 lines • 6.3 kB
JavaScript
;
// *** WARNING: this file was generated by pulumi-language-nodejs. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***
Object.defineProperty(exports, "__esModule", { value: true });
exports.CapacityBlockReservation = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("../utilities");
/**
* Provides an EC2 Capacity Block Reservation. This allows you to purchase capacity block for your Amazon EC2 instances in a specific Availability Zone for machine learning (ML) Workloads.
*
* > **NOTE:** Once created, a reservation is valid for the `duration` of the provided `capacityBlockOfferingId` and cannot be deleted. Performing a `destroy` will only remove the resource from state. For more information see [EC2 Capacity Block Reservation Documentation](https://aws.amazon.com/ec2/instance-types/p5/) and [PurchaseReservedDBInstancesOffering](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/capacity-blocks-pricing-billing.html).
*
* > **NOTE:** Due to the expense of testing this resource, we provide it as best effort. If you find it useful, and have the ability to help test or notice issues, consider reaching out to us on GitHub.
*
* ## Example Usage
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as aws from "@pulumi/aws";
*
* const test = aws.ec2.getCapacityBlockOffering({
* capacityDurationHours: 24,
* endDateRange: "2024-05-30T15:04:05Z",
* instanceCount: 1,
* instanceType: "p4d.24xlarge",
* startDateRange: "2024-04-28T15:04:05Z",
* });
* const example = new aws.ec2.CapacityBlockReservation("example", {
* capacityBlockOfferingId: test.then(test => test.capacityBlockOfferingId),
* instancePlatform: "Linux/UNIX",
* tags: {
* Environment: "dev",
* },
* });
* ```
*/
class CapacityBlockReservation extends pulumi.CustomResource {
/**
* Get an existing CapacityBlockReservation resource's state with the given name, ID, and optional extra
* properties used to qualify the lookup.
*
* @param name The _unique_ name of the resulting resource.
* @param id The _unique_ provider ID of the resource to lookup.
* @param state Any extra arguments used during the lookup.
* @param opts Optional settings to control the behavior of the CustomResource.
*/
static get(name, id, state, opts) {
return new CapacityBlockReservation(name, state, { ...opts, id: id });
}
/**
* Returns true if the given object is an instance of CapacityBlockReservation. This is designed to work even
* when multiple copies of the Pulumi SDK have been loaded into the same process.
*/
static isInstance(obj) {
if (obj === undefined || obj === null) {
return false;
}
return obj['__pulumiType'] === CapacityBlockReservation.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["arn"] = state?.arn;
resourceInputs["availabilityZone"] = state?.availabilityZone;
resourceInputs["capacityBlockOfferingId"] = state?.capacityBlockOfferingId;
resourceInputs["createdDate"] = state?.createdDate;
resourceInputs["ebsOptimized"] = state?.ebsOptimized;
resourceInputs["endDate"] = state?.endDate;
resourceInputs["endDateType"] = state?.endDateType;
resourceInputs["instanceCount"] = state?.instanceCount;
resourceInputs["instancePlatform"] = state?.instancePlatform;
resourceInputs["instanceType"] = state?.instanceType;
resourceInputs["outpostArn"] = state?.outpostArn;
resourceInputs["placementGroupArn"] = state?.placementGroupArn;
resourceInputs["region"] = state?.region;
resourceInputs["reservationType"] = state?.reservationType;
resourceInputs["startDate"] = state?.startDate;
resourceInputs["tags"] = state?.tags;
resourceInputs["tagsAll"] = state?.tagsAll;
resourceInputs["tenancy"] = state?.tenancy;
resourceInputs["timeouts"] = state?.timeouts;
}
else {
const args = argsOrState;
if (args?.capacityBlockOfferingId === undefined && !opts.urn) {
throw new Error("Missing required property 'capacityBlockOfferingId'");
}
if (args?.instancePlatform === undefined && !opts.urn) {
throw new Error("Missing required property 'instancePlatform'");
}
resourceInputs["capacityBlockOfferingId"] = args?.capacityBlockOfferingId;
resourceInputs["instancePlatform"] = args?.instancePlatform;
resourceInputs["region"] = args?.region;
resourceInputs["tags"] = args?.tags;
resourceInputs["timeouts"] = args?.timeouts;
resourceInputs["arn"] = undefined /*out*/;
resourceInputs["availabilityZone"] = undefined /*out*/;
resourceInputs["createdDate"] = undefined /*out*/;
resourceInputs["ebsOptimized"] = undefined /*out*/;
resourceInputs["endDate"] = undefined /*out*/;
resourceInputs["endDateType"] = undefined /*out*/;
resourceInputs["instanceCount"] = undefined /*out*/;
resourceInputs["instanceType"] = undefined /*out*/;
resourceInputs["outpostArn"] = undefined /*out*/;
resourceInputs["placementGroupArn"] = undefined /*out*/;
resourceInputs["reservationType"] = undefined /*out*/;
resourceInputs["startDate"] = undefined /*out*/;
resourceInputs["tagsAll"] = undefined /*out*/;
resourceInputs["tenancy"] = undefined /*out*/;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(CapacityBlockReservation.__pulumiType, name, resourceInputs, opts);
}
}
exports.CapacityBlockReservation = CapacityBlockReservation;
/** @internal */
CapacityBlockReservation.__pulumiType = 'aws:ec2/capacityBlockReservation:CapacityBlockReservation';
//# sourceMappingURL=capacityBlockReservation.js.map