Understanding Elastic IP in AWS: A Complete Guide


In cloud computing, flexibility and scalability are key—especially when it comes to networking. AWS provides a powerful feature called Elastic IP that ensures your application can maintain a consistent IP address even as the underlying infrastructure changes. In this blog post, we’ll dive deep into what Elastic IPs are, how they work, their use cases, and best practices.
📌 What is an Elastic IP in AWS?
An Elastic IP (EIP) is a static IPv4 address designed for dynamic cloud computing. It’s allocated to your AWS account and can be associated with any instance (like EC2) in your account. Unlike a regular public IP address, which may change when you stop and start an instance, an Elastic IP stays the same until you release it.
🔁 Regular Public IP vs. Elastic IP
Feature | Public IP | Elastic IP |
Changes on instance restart | Yes | No |
User-controlled | No (assigned by AWS) | Yes (you allocate it) |
Reusable | No | Yes |
🧠 Why Use an Elastic IP?
Here are some common scenarios where Elastic IPs are useful:
Disaster recovery: Quickly remap your IP to a backup instance during a failure.
DNS minimization: Avoid changing DNS records every time your server restarts.
Consistent endpoint: When you need a fixed IP for APIs, whitelisting, or firewall rules.
⚙️ How Does It Work?
Step-by-step:
Allocate Elastic IP:
- You request (allocate) an EIP from AWS. It becomes available in your account.
Associate with Resource:
- You associate the EIP with an EC2 instance, network interface, or NAT gateway.
Reassign if Needed:
- If the instance fails, you can reassign the same EIP to another instance, ensuring service continuity.
🔧 How to Allocate and Associate an Elastic IP (Console)
Go to the EC2 Dashboard → Elastic IPs.
Click “Allocate Elastic IP address.”
Choose the network (default is Amazon's pool).
Click “Allocate.”
Once allocated, select the IP → Click “Actions” → “Associate Elastic IP address.”
Choose the instance or network interface to associate with.
You can also do this using the AWS CLI:
# Allocate an Elastic IP
aws ec2 allocate-address
# Associate with an instance
aws ec2 associate-address --instance-id i-0abcdef1234567890 --allocation-id eipalloc-12345678
💰 Pricing and Charges
Free: The first Elastic IP is free as long as it’s associated with a running instance.
Charged: If it is not associated, or if you have multiple EIPs, you’ll incur small hourly charges.
Example: As of June 2025, AWS charges $0.005 per hour for an unused Elastic IP.
🛑 Best Practices
Release unused EIPs to avoid unnecessary charges.
Avoid excessive EIPs — AWS has default limits (typically 5 per region).
Use Load Balancers or Route 53 instead of Elastic IPs when scalability and high availability are needed.
Use security groups and NACLs properly to protect resources associated with EIPs.
🧪 Real-World Use Case
Imagine you’re running a customer-facing API that must be accessible at a consistent IP address (for whitelisting by client systems). You deploy your EC2 instance with an Elastic IP. If that instance goes down, you launch a new one and simply re-associate the EIP. No DNS propagation delays. No client-side changes. Just fast recovery.
🔄 Releasing Elastic IP
When you no longer need an Elastic IP:
Disassociate it from the instance.
Go to EC2 → Elastic IPs → select the IP.
Click “Release Elastic IP address.”
Or via CLI:
# Disassociate
aws ec2 disassociate-address --association-id eipassoc-12345678
# Release
aws ec2 release-address --allocation-id eipalloc-12345678
🧾 Summary
Feature | Description |
Type | Static IPv4 |
Association | EC2, Network Interface, NAT Gateway |
Cost | Free when used; charged when idle |
Use Case | Fixed IP, failover, whitelisting |
Best Alternative | Load Balancer + Route 53 (for scalable apps) |
🧠 Final Thoughts
Elastic IPs are powerful, but should be used strategically. For small setups or specific networking needs, they’re perfect. But for high-availability architectures, rely more on Elastic Load Balancers and Route 53 for DNS-based routing and failover.
Use Elastic IPs when you truly need static addressing, and always monitor and release unused ones to keep your AWS bill in check.
🤝 Need Help?
Stuck somewhere or have questions about using Elastic IPs in your AWS setup? Whether you're facing issues with association, billing, or best practices—I am here to help!
Feel free to contact for any issues.
Subscribe to my newsletter
Read articles from Tanseer Khan directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by
