Elastic IP Address Management and Design - Static IP Usage and Cost Optimization

Learn about Elastic IP allocation, EC2 association, cost implications of unused EIPs, and alternative approaches to consider.

Overview of Elastic IP

An Elastic IP (EIP) is a static public IPv4 address that you associate with an EC2 instance. While a regular EC2 public IP changes when the instance is stopped and started, an EIP retains the same IP address until you explicitly release it. EIPs are used when you need to point a DNS A record directly to an IP address or when you need to register an IP in a firewall allow list.

Cost Optimization and Alternatives

Since February 2024, all public IPv4 addresses are charged at 0.005 USD/hour. Both unused EIPs and EIPs associated with EC2 instances incur charges, making it essential to audit unnecessary EIPs. When using an ALB, reference the ALB's DNS name via CNAME and eliminate the need for EIPs. The same applies when using CloudFront. Cases where EIPs are truly necessary are limited to scenarios such as external systems that allow access by IP address, or configuring reverse DNS for SMTP servers.

EIP Design Patterns and IPv6 Migration

EIPs are commonly used in failover configurations. When an EC2 instance fails, a Lambda function can reassociate the EIP with a different instance, enabling immediate traffic switchover without waiting for DNS TTL expiration. Registering instances with EIPs as NLB targets enables load balancing with fixed IPs. Migrating to IPv6 reduces dependency on EIPs. By enabling dual-stack in your VPC and assigning IPv6 addresses to your ALB, EIPs become unnecessary for IPv6-capable clients. Global Accelerator's static Anycast IPs provide fixed IPs that include cross-region failover, serving as a viable alternative to EIPs. To deepen your understanding of static IP network design, specialized books (Amazon) can be helpful.

Public IPv4 Pricing and Reduction Strategies

Since February 2024, all public IPv4 addresses are charged at 0.005 USD/hour (approximately 3.60 USD/month). Use VPC Public IP Insights to visualize the usage of all public IPv4 addresses in your account and identify unnecessary EIPs or unused public IPs. If direct access to EC2 instances is not required, disable automatic public IP assignment and connect via Systems Manager Session Manager. Consolidating access through an ALB eliminates the need to assign EIPs to individual instances. It is recommended to track Elastic IP costs in Cost Explorer and conduct monthly audits of unnecessary EIPs.

Summary

Elastic IP provides static public IPv4 addresses, but since 2024, the enhanced pricing applies a charge of 0.005 USD/hour to all public IPv4 addresses. Migrating to ALB or CloudFront reduces EIP dependency, and Global Accelerator's static Anycast IPs provide fixed IPs with cross-region failover capabilities. Adopting IPv6 dual-stack is also an effective cost reduction strategy.