π 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.
π 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
β οΈ Important Notes:
- AWS charges for unused Elastic IPs.
- Use EIPs wiselyβprefer Load Balancers or Route 53 for scalable solutions.