AWS Lightsail Static IP Attachment

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

aws_lightsail_static_ip_attachment (Terraform)

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

Example Usage from GitHub

microsite.tf#L39
resource "aws_lightsail_static_ip_attachment" "blog_beramaljariyah" {
  static_ip_name = aws_lightsail_static_ip.blog_beramaljariyah.name
  instance_name  = aws_lightsail_instance.blog_beramaljariyah.name
}

resource "aws_route53_record" "baj_blog" {
librata-io-static-ip-attachment.tf#L1
resource "aws_lightsail_static_ip_attachment" "librata-io-static-ip-attachment" {
  static_ip_name = aws_lightsail_static_ip.librata-io-static-ip.id
  instance_name  = aws_lightsail_instance.librata-io-wordpress.id
}
lightsail.tf#L17
resource "aws_lightsail_static_ip_attachment" "default" {
  static_ip_name = aws_lightsail_static_ip.default.id
  instance_name  = aws_lightsail_instance.default.id
}

resource "aws_lightsail_domain" "default" {
main.tf#L33
resource "aws_lightsail_static_ip_attachment" "test" {
  static_ip_name = aws_lightsail_static_ip.test.id
  instance_name  = aws_lightsail_instance.test.id
}

main.tf#L34
resource "aws_lightsail_static_ip_attachment" "attach" {
  static_ip_name = aws_lightsail_static_ip.static-ip.id
  instance_name  = aws_lightsail_instance.nodejsite.id

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 static IP address attachment - relationship between a Lightsail static IP & Lightsail instance.

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 Attachment?

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

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.