Elastic IP
π¦ Overviewβ
This Terraform module provisions a standalone Elastic IP (EIP) in AWS for resources requiring a fixed public IPv4 address.
Itβs ideal for use with NAT gateways, bastion hosts, or any compute instance needing consistent public exposure.
β Key Featuresβ
- Allocates a static public IPv4 address in a chosen region
- Tags the EIP with
Name,Environment, and other metadata - Can be used independently or integrated into composed stacks
- Returns both the EIP address and allocation ID as outputs
πΌ Use Casesβ
- Assigning a static IP to bastion hosts for SSH access
- Reserving an address for a NAT Gateway in a private subnet setup
- Supporting allowlists in firewalls that require fixed IPs
- Mapping DNS records to a consistent IP during CI/CD deployments
π₯ Input Variablesβ
| Name | Type | Description |
|---|---|---|
| region | string | AWS region to deploy the Elastic IP |
| environment | string | Tag to specify the deployment environment (e.g., dev, staging, prod) |
| name | string | Descriptive tag for identifying the EIP |
π€ Outputsβ
| Name | Description |
|---|---|
| eip_id | The ID of the created Elastic IP |
| eip_address | The public IPv4 address assigned |
π Deployment Readinessβ
- β Compatible with Terraform 1.0+
- β Tested with AWS provider 5.x
- π§ͺ Requires IAM permissions for
ec2:AllocateAddressandec2:DescribeAddresses
π οΈ Example Usageβ
module "elastic_ip" {
source = "git::ssh://git@github.com/archiphire/aws-level-1-modules.git//network/elastic-ip?ref=v1.0.0"
region = "us-east-1"
environment = "prod"
name = "bastion-ip"
}
terraform init
terraform plan
terraform apply
or
tofu init
tofu plan
tofu apply
π§Ή Cleanup Optionsβ
Terraform Destroy (for test environments):
terraform destroy
or
tofu destroy
Manual Deletion (for production):
Release the Elastic IP manually in the AWS Console or via CLI:
aws ec2 release-address --allocation-id <eip_id>
π‘οΈ Notesβ
This is a Level 1 networking module for provisioning static IPs. To associate this EIP with EC2 instances or NAT gateways, refer to the relevant module documentation for those resources.
π Deployment Package Noticeβ
This module is part of the Level 1 AWS License Tier. To access the full deployment package and source code, subscribe to Archiphire.