AWS Elastic IP Training Summary
Elastic IP (EIP) is a static IPv4 address designed for dynamic cloud computing in AWS. It is a reserved public IP address that you can assign to an EC2 instance and remap to other instances as needed.
Key Points
- Elastic IP Usage: Elastic IPs are used when a constant public IP is necessary. They are particularly useful for:
- Masking instance or software failures by quickly remapping the IP to another instance running the same software.
- Ensuring that certain applications or services that rely on a fixed IP address remain accessible.
- Billing: Elastic IPs are free as long as they are attached to an EC2 instance. However, if they are reserved but not associated with an instance, you will incur charges.
- Limitations: By default, AWS accounts are limited to five Elastic IPs. You can request more if necessary, but AWS encourages the use of alternative methods such as DNS names or Load Balancers.
- Alternatives: Instead of using Elastic IPs, consider:
- Using a random public IP and registering a DNS name with Route 53.
- Utilizing a Load Balancer, which provides a static hostname and can redirect traffic to the correct EC2 instance.
Hands-On Demonstration
- Security Group Setup: Ensure the security group allows SSH access from any IP.
- EC2 Instance Setup:
- Create two EC2 instances, each with a unique file (
hello-instance-1.txt and hello-instance-2.txt) to identify them.
- Elastic IP Allocation and Association:
- Allocate a new Elastic IP from Amazon's pool or use your own.
- Associate the Elastic IP with the first EC2 instance.
- Verify that the instance's public IP matches the Elastic IP.
- Elastic IP Remapping:
- Disassociate the Elastic IP from the first instance.
- Associate the Elastic IP with the second instance.
- Verify access to the second instance using the same SSH command, which now points to
hello-instance-2.txt.
- Cleanup:
- Terminate the second instance.
- Disassociate and release the Elastic IP to avoid unnecessary charges.
Conclusion
Elastic IPs provide a powerful way to maintain a consistent public IP address for EC2 instances. However, they should be used judiciously due to potential costs and the availability of other AWS services that can provide similar functionality.
I hope this session was informative, and I look forward to our next lecture.