@pulumi/aws
Version:
A Pulumi package for creating and managing Amazon Web Services (AWS) cloud resources.
149 lines • 7.72 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.AmiFromInstance = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("../utilities");
/**
* The "AMI from instance" resource allows the creation of an Amazon Machine
* Image (AMI) modeled after an existing EBS-backed EC2 instance.
*
* The created AMI will refer to implicitly-created snapshots of the instance's
* EBS volumes and mimick its assigned block device configuration at the time
* the resource is created.
*
* This resource is best applied to an instance that is stopped when this instance
* is created, so that the contents of the created image are predictable. When
* applied to an instance that is running, *the instance will be stopped before taking
* the snapshots and then started back up again*, resulting in a period of
* downtime.
*
* Note that the source instance is inspected only at the initial creation of this
* resource. Ongoing updates to the referenced instance will not be propagated into
* the generated AMI. Users may taint or otherwise recreate the resource in order
* to produce a fresh snapshot.
*
* ## Example Usage
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as aws from "@pulumi/aws";
*
* const example = new aws.ec2.AmiFromInstance("example", {
* name: "example",
* sourceInstanceId: "i-xxxxxxxx",
* });
* ```
*/
class AmiFromInstance extends pulumi.CustomResource {
/**
* Get an existing AmiFromInstance 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 AmiFromInstance(name, state, { ...opts, id: id });
}
/**
* Returns true if the given object is an instance of AmiFromInstance. 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'] === AmiFromInstance.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["architecture"] = state?.architecture;
resourceInputs["arn"] = state?.arn;
resourceInputs["bootMode"] = state?.bootMode;
resourceInputs["deprecationTime"] = state?.deprecationTime;
resourceInputs["description"] = state?.description;
resourceInputs["ebsBlockDevices"] = state?.ebsBlockDevices;
resourceInputs["enaSupport"] = state?.enaSupport;
resourceInputs["ephemeralBlockDevices"] = state?.ephemeralBlockDevices;
resourceInputs["hypervisor"] = state?.hypervisor;
resourceInputs["imageLocation"] = state?.imageLocation;
resourceInputs["imageOwnerAlias"] = state?.imageOwnerAlias;
resourceInputs["imageType"] = state?.imageType;
resourceInputs["imdsSupport"] = state?.imdsSupport;
resourceInputs["kernelId"] = state?.kernelId;
resourceInputs["lastLaunchedTime"] = state?.lastLaunchedTime;
resourceInputs["manageEbsSnapshots"] = state?.manageEbsSnapshots;
resourceInputs["name"] = state?.name;
resourceInputs["ownerId"] = state?.ownerId;
resourceInputs["platform"] = state?.platform;
resourceInputs["platformDetails"] = state?.platformDetails;
resourceInputs["public"] = state?.public;
resourceInputs["ramdiskId"] = state?.ramdiskId;
resourceInputs["region"] = state?.region;
resourceInputs["rootDeviceName"] = state?.rootDeviceName;
resourceInputs["rootSnapshotId"] = state?.rootSnapshotId;
resourceInputs["snapshotWithoutReboot"] = state?.snapshotWithoutReboot;
resourceInputs["sourceInstanceId"] = state?.sourceInstanceId;
resourceInputs["sriovNetSupport"] = state?.sriovNetSupport;
resourceInputs["tags"] = state?.tags;
resourceInputs["tagsAll"] = state?.tagsAll;
resourceInputs["tpmSupport"] = state?.tpmSupport;
resourceInputs["uefiData"] = state?.uefiData;
resourceInputs["usageOperation"] = state?.usageOperation;
resourceInputs["virtualizationType"] = state?.virtualizationType;
}
else {
const args = argsOrState;
if (args?.sourceInstanceId === undefined && !opts.urn) {
throw new Error("Missing required property 'sourceInstanceId'");
}
resourceInputs["deprecationTime"] = args?.deprecationTime;
resourceInputs["description"] = args?.description;
resourceInputs["ebsBlockDevices"] = args?.ebsBlockDevices;
resourceInputs["ephemeralBlockDevices"] = args?.ephemeralBlockDevices;
resourceInputs["name"] = args?.name;
resourceInputs["region"] = args?.region;
resourceInputs["snapshotWithoutReboot"] = args?.snapshotWithoutReboot;
resourceInputs["sourceInstanceId"] = args?.sourceInstanceId;
resourceInputs["tags"] = args?.tags;
resourceInputs["architecture"] = undefined /*out*/;
resourceInputs["arn"] = undefined /*out*/;
resourceInputs["bootMode"] = undefined /*out*/;
resourceInputs["enaSupport"] = undefined /*out*/;
resourceInputs["hypervisor"] = undefined /*out*/;
resourceInputs["imageLocation"] = undefined /*out*/;
resourceInputs["imageOwnerAlias"] = undefined /*out*/;
resourceInputs["imageType"] = undefined /*out*/;
resourceInputs["imdsSupport"] = undefined /*out*/;
resourceInputs["kernelId"] = undefined /*out*/;
resourceInputs["lastLaunchedTime"] = undefined /*out*/;
resourceInputs["manageEbsSnapshots"] = undefined /*out*/;
resourceInputs["ownerId"] = undefined /*out*/;
resourceInputs["platform"] = undefined /*out*/;
resourceInputs["platformDetails"] = undefined /*out*/;
resourceInputs["public"] = undefined /*out*/;
resourceInputs["ramdiskId"] = undefined /*out*/;
resourceInputs["rootDeviceName"] = undefined /*out*/;
resourceInputs["rootSnapshotId"] = undefined /*out*/;
resourceInputs["sriovNetSupport"] = undefined /*out*/;
resourceInputs["tagsAll"] = undefined /*out*/;
resourceInputs["tpmSupport"] = undefined /*out*/;
resourceInputs["uefiData"] = undefined /*out*/;
resourceInputs["usageOperation"] = undefined /*out*/;
resourceInputs["virtualizationType"] = undefined /*out*/;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(AmiFromInstance.__pulumiType, name, resourceInputs, opts);
}
}
exports.AmiFromInstance = AmiFromInstance;
/** @internal */
AmiFromInstance.__pulumiType = 'aws:ec2/amiFromInstance:AmiFromInstance';
//# sourceMappingURL=amiFromInstance.js.map