AWS Lightsail Instance

This page shows how to write Terraform and CloudFormation for Lightsail Instance and write them securely.

aws_lightsail_instance (Terraform)

The Instance in Lightsail can be configured in Terraform with the resource name aws_lightsail_instance. The following sections describe 4 examples of how to use the resource and its parameters.

Example Usage from GitHub

microsite.tf#L22
resource "aws_lightsail_instance" "blog_beramaljariyah" {
  name              = "blog.beramaljariyah.org"
  availability_zone = "ap-southeast-1a"
  blueprint_id      = "ubuntu_18_04"
  bundle_id         = "micro_2_0"
  key_pair_name     = "evermos"
lightsail_instance_test.tf#L12
resource "aws_lightsail_instance" "linux1" {
  name              = "linux1"
  availability_zone = "us-east-1a"
  blueprint_id      = "centos_7_1901_01"
  bundle_id         = "xlarge_2_0"
}
lightsail_instance_test.tf#L12
resource "aws_lightsail_instance" "linux1" {
  name              = "linux1"
  availability_zone = "us-east-1a"
  blueprint_id      = "centos_7_1901_01"
  bundle_id         = "xlarge_2_0"
}
main.tf#L30
resource "aws_lightsail_instance" "Autozona-Master" {
  name              = "Autozona-Master"
  availability_zone = "us-east-1a"
  blueprint_id      = "ubuntu_18_04"
  bundle_id         = "micro_2_0"
  key_pair_name     = "Autozona"

Review your Terraform file for AWS best practices

Shisho Cloud, our free checker to make sure your Terraform configuration follows best practices, is available (beta).

Parameters

Explanation in Terraform Registry

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

AWS::Lightsail::Instance (CloudFormation)

The Instance in Lightsail can be configured in CloudFormation with the resource name AWS::Lightsail::Instance. The following sections describe 2 examples of how to use the resource and its parameters.

Example Usage from GitHub

LightSail.yaml#L24
    Type: AWS::Lightsail::Instance
    Properties:
      BlueprintId: !Ref BluePrintId
      BundleId: !Ref BundleId
      InstanceName: !Ref InstanceName
      Networking:
jarvis-stack-dev.yaml#L15
    Type: AWS::Lightsail::Instance
    CreationPolicy:
      ResourceSignal:
        Timeout: PT15M
    Properties:
      BlueprintId: ubuntu_20_04

Parameters

Explanation in CloudFormation Registry

The AWS::Lightsail::Instance resource specifies an Amazon Lightsail instance.

Frequently asked questions

What is AWS Lightsail Instance?

AWS Lightsail Instance is a resource for Lightsail of Amazon Web Service. Settings can be wrote in Terraform and CloudFormation.

Where can I find the example code for the AWS Lightsail Instance?

For Terraform, the bentinata/tf, gilyas/infracost and infracost/infracost source code examples are useful. See the Terraform Example section for further details.

For CloudFormation, the allendcanning/cloudformation and AlexMikhalochkin/jarvis source code examples are useful. See the CloudFormation Example section for further details.