🌐 What is an Elastic IP (EIP) in AWS?

AnΒ Elastic IP is a static, public IPv4 address provided by AWS that you can associate with an EC2 instance (or a network interface). Unlike standard public IPs, an EIP does not change when you stop or start an instance.

Generated image


πŸ” Key Features of Elastic IP:

Feature Description
Static Remains the same until you release it
Public IP Reachable over the Internet
Reassignable Can be moved between instances in your account
IPv4 Only EIPs are for IPv4; AWS does not support static IPv6 via EIP
1 Free EIP per account Free only when associated with a running instance

🧠 Why Use Elastic IP?

  • Maintain a fixed public IP even if instance restarts
  • Useful for DNS entries, whitelisting in firewalls, and static site hosting
  • Quickly remap the EIP to another instance in case of instance failure

πŸ’‘ Example Scenario:

You're running a web server on EC2 and have a domain name pointing to its IP. If the EC2 instance stops and restarts, a regular public IP will change. But with an Elastic IP, your server keeps the same IP – so your DNS records don't break.


πŸ› οΈ Basic CLI Usage

# Allocate an Elastic IP
aws ec2 allocate-address

# Associate EIP to instance
aws ec2 associate-address --instance-id i-1234567890abcdef0 --allocation-id eipalloc-abcdefg


⚠️ Important Notes:

  • AWS charges for unused Elastic IPs.
  • Use EIPs wiselyβ€”prefer Load Balancers or Route 53 for scalable solutions.
Back to blog

Leave a comment