An Elastic IP (EIP) is a static public IP address in AWS that you can assign to EC2 instances. It provides a consistent IP address even if the instance it’s associated with is stopped, started, or replaced.
Definition:
- Elastic IP is a public, IPv4 address that you can attach to any EC2 instance within a VPC.
- Unlike a standard public IP assigned by AWS, an EIP is static and remains with your AWS account until you release it.
Purpose:
- Static Address: Ideal for applications that require a consistent IP, such as web servers, databases, or VPN endpoints.
- High Availability: If an instance fails, you can remap the EIP to a standby instance quickly, minimizing downtime.
How It Works:
- When you allocate an EIP, it’s assigned to your AWS account.
- You can associate it with any instance in a VPC, and re-associate it if needed.
- AWS allows one free EIP per account per instance, but charges for any additional or unused EIPs.
Charges:
- AWS charges for Elastic IPs that are allocated but not associated with a running instance.
- There's no charge for using a single Elastic IP with a running instance, but if you have unused EIPs, hourly fees apply.
Best Practices:
- Only Allocate What You Need: Allocate an Elastic IP only if a static IP is necessary to avoid unnecessary costs.
- Automatic Failover: For high-availability setups, consider EIP re-association to switch to backup instances.
- Release Unused EIPs: Release any Elastic IPs that are no longer needed to avoid charges and improve management.
Elastic IPs offer flexibility for failover and high-availability setups, providing reliable connectivity and control over your instance's public IP.