@pulumi/aws
Version:
A Pulumi package for creating and managing Amazon Web Services (AWS) cloud resources.
168 lines • 7.02 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, { ...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?.addOn;
resourceInputs["arn"] = state?.arn;
resourceInputs["availabilityZone"] = state?.availabilityZone;
resourceInputs["blueprintId"] = state?.blueprintId;
resourceInputs["bundleId"] = state?.bundleId;
resourceInputs["cpuCount"] = state?.cpuCount;
resourceInputs["createdAt"] = state?.createdAt;
resourceInputs["ipAddressType"] = state?.ipAddressType;
resourceInputs["ipv6Addresses"] = state?.ipv6Addresses;
resourceInputs["isStaticIp"] = state?.isStaticIp;
resourceInputs["keyPairName"] = state?.keyPairName;
resourceInputs["name"] = state?.name;
resourceInputs["privateIpAddress"] = state?.privateIpAddress;
resourceInputs["publicIpAddress"] = state?.publicIpAddress;
resourceInputs["ramSize"] = state?.ramSize;
resourceInputs["region"] = state?.region;
resourceInputs["tags"] = state?.tags;
resourceInputs["tagsAll"] = state?.tagsAll;
resourceInputs["userData"] = state?.userData;
resourceInputs["username"] = state?.username;
}
else {
const args = argsOrState;
if (args?.availabilityZone === undefined && !opts.urn) {
throw new Error("Missing required property 'availabilityZone'");
}
if (args?.blueprintId === undefined && !opts.urn) {
throw new Error("Missing required property 'blueprintId'");
}
if (args?.bundleId === undefined && !opts.urn) {
throw new Error("Missing required property 'bundleId'");
}
resourceInputs["addOn"] = args?.addOn;
resourceInputs["availabilityZone"] = args?.availabilityZone;
resourceInputs["blueprintId"] = args?.blueprintId;
resourceInputs["bundleId"] = args?.bundleId;
resourceInputs["ipAddressType"] = args?.ipAddressType;
resourceInputs["keyPairName"] = args?.keyPairName;
resourceInputs["name"] = args?.name;
resourceInputs["region"] = args?.region;
resourceInputs["tags"] = args?.tags;
resourceInputs["userData"] = args?.userData;
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