InstanceArgs

data class InstanceArgs(val addOn: Output<InstanceAddOnArgs>? = null, val availabilityZone: Output<String>? = null, val blueprintId: Output<String>? = null, val bundleId: Output<String>? = null, val ipAddressType: Output<String>? = null, val keyPairName: Output<String>? = null, val name: Output<String>? = null, val tags: Output<Map<String, String>>? = null, val userData: Output<String>? = null) : ConvertibleToJava<InstanceArgs>

Provides a Lightsail Instance. Amazon Lightsail is a service to provide easy virtual private servers with custom software already setup. See What is Amazon Lightsail? for more information.

Note: Lightsail is currently only supported in a limited number of AWS Regions, please see "Regions and Availability Zones in Amazon Lightsail" for more details

Example Usage

Basic Usage

package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.lightsail.Instance;
import com.pulumi.aws.lightsail.InstanceArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
var gitlabTest = new Instance("gitlabTest", InstanceArgs.builder()
.availabilityZone("us-east-1b")
.blueprintId("amazon_linux_2")
.bundleId("nano_1_0")
.keyPairName("some_key_name")
.tags(Map.of("foo", "bar"))
.build());
}
}

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.

package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.lightsail.Instance;
import com.pulumi.aws.lightsail.InstanceArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
var custom = new Instance("custom", InstanceArgs.builder()
.availabilityZone("us-east-1b")
.blueprintId("amazon_linux_2")
.bundleId("nano_1_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")
.build());
}
}

Enable Auto Snapshots

package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.lightsail.Instance;
import com.pulumi.aws.lightsail.InstanceArgs;
import com.pulumi.aws.lightsail.inputs.InstanceAddOnArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
var test = new Instance("test", InstanceArgs.builder()
.addOn(InstanceAddOnArgs.builder()
.snapshotTime("06:00")
.status("Enabled")
.type("AutoSnapshot")
.build())
.availabilityZone("us-east-1b")
.blueprintId("amazon_linux_2")
.bundleId("nano_1_0")
.tags(Map.of("foo", "bar"))
.build());
}
}

Availability Zones

Lightsail currently supports the following Availability Zones (e.g., us-east-1a):

  • ap-northeast-1{a,c,d}

  • ap-northeast-2{a,c}

  • ap-south-1{a,b}

  • ap-southeast-1{a,b,c}

  • ap-southeast-2{a,b,c}

  • ca-central-1{a,b}

  • eu-central-1{a,b,c}

  • eu-west-1{a,b,c}

  • eu-west-2{a,b,c}

  • eu-west-3{a,b,c}

  • us-east-1{a,b,c,d,e,f}

  • us-east-2{a,b,c}

  • us-west-2{a,b,c}

Bundles

Lightsail currently supports the following Bundle IDs (e.g., an instance in ap-northeast-1 would use small_2_0):

Prefix

A Bundle ID starts with one of the below size prefixes:

  • nano_

  • micro_

  • small_

  • medium_

  • large_

  • xlarge_

  • 2xlarge_

Suffix

A Bundle ID ends with one of the following suffixes depending on Availability Zone:

  • ap-northeast-1: 2_0

  • ap-northeast-2: 2_0

  • ap-south-1: 2_1

  • ap-southeast-1: 2_0

  • ap-southeast-2: 2_2

  • ca-central-1: 2_0

  • eu-central-1: 2_0

  • eu-west-1: 2_0

  • eu-west-2: 2_0

  • eu-west-3: 2_0

  • us-east-1: 2_0

  • us-east-2: 2_0

  • us-west-2: 2_0

Import

Lightsail Instances can be imported using their name, e.g.,

$ pulumi import aws:lightsail/instance:Instance gitlab_test 'custom_gitlab'

Constructors

Link copied to clipboard
constructor(addOn: Output<InstanceAddOnArgs>? = null, availabilityZone: Output<String>? = null, blueprintId: Output<String>? = null, bundleId: Output<String>? = null, ipAddressType: Output<String>? = null, keyPairName: Output<String>? = null, name: Output<String>? = null, tags: Output<Map<String, String>>? = null, userData: Output<String>? = null)

Properties

Link copied to clipboard
val addOn: Output<InstanceAddOnArgs>? = null

The add on configuration for the instance. Detailed below.

Link copied to clipboard
val availabilityZone: Output<String>? = null

The Availability Zone in which to create your instance (see list below)

Link copied to clipboard
val blueprintId: Output<String>? = null

The ID for a virtual private server image. A list of available blueprint IDs can be obtained using the AWS CLI command: aws lightsail get-blueprints

Link copied to clipboard
val bundleId: Output<String>? = null

The bundle of specification information (see list below)

Link copied to clipboard
val ipAddressType: Output<String>? = null

The IP address type of the Lightsail Instance. Valid Values: dualstack | ipv4.

Link copied to clipboard
val keyPairName: Output<String>? = null

The name of your key pair. Created in the Lightsail console (cannot use aws.ec2.KeyPair at this time)

Link copied to clipboard
val name: Output<String>? = null

The name of the Lightsail Instance. Names be unique within each AWS Region in your Lightsail account.

Link copied to clipboard
val tags: Output<Map<String, String>>? = null

A map of tags to assign to the resource. To create a key-only tag, use an empty string as the value. .If configured with a provider default_tags configuration block present, tags with matching keys will overwrite those defined at the provider-level.

Link copied to clipboard
val userData: Output<String>? = null

Single lined launch script as a string to configure server with additional user data

Functions

Link copied to clipboard
open override fun toJava(): InstanceArgs