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
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
resource "aws_lightsail_static_ip" "librata-io-static-ip" {
name = "librata-io-static-ip"
resource "aws_lightsail_static_ip" "default" {
name = "wordpress"
}
resource "aws_lightsail_static_ip_attachment" "default" {
static_ip_name = aws_lightsail_static_ip.default.id
resource "aws_lightsail_static_ip" "test" {
name = "lightsail_nex4_ip"
}
# attach static ip
resource "aws_lightsail_static_ip_attachment" "test" {
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
Parameters
-
arn
optional computed - string -
id
optional computed - string -
ip_address
optional computed - string -
name
required - string -
support_code
optional computed - string
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
-
StaticIpName
required - String -
AttachedTo
optional - String
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.