AWS Lightsail Static IP

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

aws_lightsail_static_ip (Terraform)

The Static IP in Lightsail can be configured in Terraform with the resource name aws_lightsail_static_ip. The following sections describe 5 examples of how to use the resource and its parameters.

Example Usage from GitHub

microsite.tf#L35
resource "aws_lightsail_static_ip" "blog_beramaljariyah" {
  name = "blog.beramaljariyah.org-static"
}

resource "aws_lightsail_static_ip_attachment" "blog_beramaljariyah" {
  static_ip_name = aws_lightsail_static_ip.blog_beramaljariyah.name
librata-io-static-ip.tf#L1
resource "aws_lightsail_static_ip" "librata-io-static-ip" {
  name       = "librata-io-static-ip"
lightsail.tf#L13
resource "aws_lightsail_static_ip" "default" {
  name = "wordpress"
}

resource "aws_lightsail_static_ip_attachment" "default" {
  static_ip_name = aws_lightsail_static_ip.default.id
main.tf#L28
resource "aws_lightsail_static_ip" "test" {
  name = "lightsail_nex4_ip"
}

# attach static ip
resource "aws_lightsail_static_ip_attachment" "test" {
main.tf#L17
resource "aws_lightsail_static_ip" "test" {
  name = "silver_ligthsail_1"
}

resource "aws_lightsail_static_ip_attachment" "test" {
  static_ip_name = aws_lightsail_static_ip.test.name

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

Allocates a static IP address.

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::StaticIp (CloudFormation)

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

Example Usage from GitHub

An example could not be found in GitHub.

Parameters

Explanation in CloudFormation Registry

The AWS::Lightsail::StaticIp resource specifies a static IP that can be attached to an Amazon Lightsail instance that is in the same AWS Region and Availability Zone.

Frequently asked questions

What is AWS Lightsail Static IP?

AWS Lightsail Static IP 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 Static IP?

For Terraform, the bentinata/tf, william-librata/librata-io-wordpress and devops-adeel/wordpress source code examples are useful. See the Terraform Example section for further details.