@pulumi/aws
Version:
A Pulumi package for creating and managing Amazon Web Services (AWS) cloud resources.
168 lines • 7.64 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.Instance = void 0;
const pulumi = require("@pulumi/pulumi");
const utilities = require("../utilities");
/**
* Manages a Lightsail Instance. Use this resource to create easy virtual private servers with custom software already setup.
*
* > **Note:** Lightsail is currently only supported in a limited number of AWS Regions, please see ["Regions and Availability Zones in Amazon Lightsail"](https://lightsail.aws.amazon.com/ls/docs/overview/article/understanding-regions-and-availability-zones-in-amazon-lightsail) for more details
*
* ## Example Usage
*
* ### Basic Usage
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as aws from "@pulumi/aws";
*
* const example = new aws.lightsail.Instance("example", {
* name: "example",
* availabilityZone: "us-east-1b",
* blueprintId: "amazon_linux_2",
* bundleId: "nano_3_0",
* keyPairName: "some_key_name",
* tags: {
* foo: "bar",
* },
* });
* ```
*
* ### Example With User Data
*
* Lightsail user data is handled differently than EC2 user data. Lightsail user data only accepts a single lined string. The below example shows installing apache and creating the index page.
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as aws from "@pulumi/aws";
*
* const example = new aws.lightsail.Instance("example", {
* name: "example",
* availabilityZone: "us-east-1b",
* blueprintId: "amazon_linux_2",
* bundleId: "nano_3_0",
* userData: "sudo yum install -y httpd && sudo systemctl start httpd && sudo systemctl enable httpd && echo '<h1>Deployed via Pulumi</h1>' | sudo tee /var/www/html/index.html",
* });
* ```
*
* ### Enable Auto Snapshots
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as aws from "@pulumi/aws";
*
* const example = new aws.lightsail.Instance("example", {
* name: "example",
* availabilityZone: "us-east-1b",
* blueprintId: "amazon_linux_2",
* bundleId: "nano_3_0",
* addOn: {
* type: "AutoSnapshot",
* snapshotTime: "06:00",
* status: "Enabled",
* },
* tags: {
* foo: "bar",
* },
* });
* ```
*
* ## Import
*
* Using `pulumi import`, import Lightsail Instances using their name. For example:
*
* ```sh
* $ pulumi import aws:lightsail/instance:Instance example 'example'
* ```
*/
class Instance extends pulumi.CustomResource {
/**
* Get an existing Instance 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 Instance(name, state, Object.assign(Object.assign({}, opts), { id: id }));
}
/**
* Returns true if the given object is an instance of Instance. 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'] === Instance.__pulumiType;
}
constructor(name, argsOrState, opts) {
let resourceInputs = {};
opts = opts || {};
if (opts.id) {
const state = argsOrState;
resourceInputs["addOn"] = state ? state.addOn : undefined;
resourceInputs["arn"] = state ? state.arn : undefined;
resourceInputs["availabilityZone"] = state ? state.availabilityZone : undefined;
resourceInputs["blueprintId"] = state ? state.blueprintId : undefined;
resourceInputs["bundleId"] = state ? state.bundleId : undefined;
resourceInputs["cpuCount"] = state ? state.cpuCount : undefined;
resourceInputs["createdAt"] = state ? state.createdAt : undefined;
resourceInputs["ipAddressType"] = state ? state.ipAddressType : undefined;
resourceInputs["ipv6Addresses"] = state ? state.ipv6Addresses : undefined;
resourceInputs["isStaticIp"] = state ? state.isStaticIp : undefined;
resourceInputs["keyPairName"] = state ? state.keyPairName : undefined;
resourceInputs["name"] = state ? state.name : undefined;
resourceInputs["privateIpAddress"] = state ? state.privateIpAddress : undefined;
resourceInputs["publicIpAddress"] = state ? state.publicIpAddress : undefined;
resourceInputs["ramSize"] = state ? state.ramSize : undefined;
resourceInputs["region"] = state ? state.region : undefined;
resourceInputs["tags"] = state ? state.tags : undefined;
resourceInputs["tagsAll"] = state ? state.tagsAll : undefined;
resourceInputs["userData"] = state ? state.userData : undefined;
resourceInputs["username"] = state ? state.username : undefined;
}
else {
const args = argsOrState;
if ((!args || args.availabilityZone === undefined) && !opts.urn) {
throw new Error("Missing required property 'availabilityZone'");
}
if ((!args || args.blueprintId === undefined) && !opts.urn) {
throw new Error("Missing required property 'blueprintId'");
}
if ((!args || args.bundleId === undefined) && !opts.urn) {
throw new Error("Missing required property 'bundleId'");
}
resourceInputs["addOn"] = args ? args.addOn : undefined;
resourceInputs["availabilityZone"] = args ? args.availabilityZone : undefined;
resourceInputs["blueprintId"] = args ? args.blueprintId : undefined;
resourceInputs["bundleId"] = args ? args.bundleId : undefined;
resourceInputs["ipAddressType"] = args ? args.ipAddressType : undefined;
resourceInputs["keyPairName"] = args ? args.keyPairName : undefined;
resourceInputs["name"] = args ? args.name : undefined;
resourceInputs["region"] = args ? args.region : undefined;
resourceInputs["tags"] = args ? args.tags : undefined;
resourceInputs["userData"] = args ? args.userData : undefined;
resourceInputs["arn"] = undefined /*out*/;
resourceInputs["cpuCount"] = undefined /*out*/;
resourceInputs["createdAt"] = undefined /*out*/;
resourceInputs["ipv6Addresses"] = undefined /*out*/;
resourceInputs["isStaticIp"] = undefined /*out*/;
resourceInputs["privateIpAddress"] = undefined /*out*/;
resourceInputs["publicIpAddress"] = undefined /*out*/;
resourceInputs["ramSize"] = undefined /*out*/;
resourceInputs["tagsAll"] = undefined /*out*/;
resourceInputs["username"] = undefined /*out*/;
}
opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts);
super(Instance.__pulumiType, name, resourceInputs, opts);
}
}
exports.Instance = Instance;
/** @internal */
Instance.__pulumiType = 'aws:lightsail/instance:Instance';
//# sourceMappingURL=instance.js.map