Elastic IP
AWS
Cloud Computing
Networking
Amazon Web Services

What is Elastic IP in AWS and why it is useful?

System Design practice on Codemia

Work through 120+ system design problems with detailed solutions, from rate limiters to multi-region storage.

Practice system design

Elastic IP (EIP) addresses in Amazon Web Services (AWS) serve as public IPs for instances, allowing them to interact with the internet. AWS customers often utilize Elastic IP addresses to mask any unnecessary changes in an instance's public IP. This article will delve into the technicalities of Elastic IPs, their benefits, as well as some examples of their usage.

The Basics of Elastic IP

An Elastic IP is a static IPv4 address designed for dynamic cloud computing in AWS. Elastic IPs enable organizations to manage changes to their instance or replace a stopped or terminated instance seamlessly without affecting the overall network communications. These IPs can be associated with any instance and are largely used for fault-tolerant and high-availability environments.

Key Characteristics of Elastic IP Addresses:

  1. Persistence: Unlike standard public IP addresses, which are subject to change when an instance starts or stops, Elastic IPs are static. Once allocated, they remain associated with your AWS account until you choose to release them.
  2. IPv4 Only: Elastic IPs are IPv4 only. AWS currently does not provide Elastic IPs for IPv6.
  3. Account Bound: Once allocated, an Elastic IP is associated with your AWS account, not a specific instance. It provides a stable IP for users and applications relying on static IP addresses.
  4. Regional Resource: Elastic IPs are allocated per region. You can't transfer an Elastic IP to another region directly, which emphasizes careful resource planning within AWS environments.

Technical Workflow

To use an Elastic IP:

  1. Allocate an Elastic IP Address: Using the AWS Management Console, CLI, or an SDK, request a new Elastic IP address.
  2. Associate the Elastic IP Address: The allocated IP is then linked to a running instance. The association can be with an EC2 instance, Elastic Network Interface (ENI), or through a NAT gateway.
  3. Re-association: Elastic IPs can be re-associated from one instance to another as needed without interrupting your applications.

Example

Let's consider that you have a web application running on an EC2 instance. Initially, this instance is using its default public IP address. Over time, you may need to stop or replace this instance due to updates or maintenance. A typical public IP changes each time the instance is stopped and restarted, causing significant issues for stable DNS resolutions, breaking client-server interactions. Here's where Elastic IP comes in handy:

  • Allocate an Elastic IP for the application.
  • Associate it with your EC2 instance.
  • If the EC2 instance needs to be stopped or replaced, simply re-associate the Elastic IP with the new instance, minimizing downtime and configuration changes.

Benefits of Using Elastic IP

  1. High Availability: Reducing application downtime by allowing seamless transitions between instances ensures business continuity.
  2. Simplified Network Management: Retain control over IP management, making it easier to handle networking disruptions or changes.
  3. Cost-effective: Elastic IPs are free when associated with an instance that is running. The charge is incurred only for unused Elastic IPs, promoting resource efficiency.
  4. Flexibility: They allow dynamic cloud computing environments to bind multiple Elastic IP addresses to a single instance, providing more extensive networking capabilities.
  5. Fault-tolerance: Enables building fault-tolerant systems by quickly re-assigning Elastic IPs during failure conditions.

Potential Pitfalls

Despite their benefits, there are some considerations to keep in mind:

  • Cost of Unused Elastic IPs: If an Elastic IP address is not associated with a running instance, AWS charges a small monthly fee. It's designed to encourage the efficient use of Elastic IPs.
  • Limited Supply: Amazon limits the number of Elastic IPs per region to five by default, making it crucial to prudently use and manage available resources.

Elastic IP Usage Summary

Here's a summarized view to understand Elastic IPs better:

FeatureDescription
PersistenceRemains with the account until released
AssociationDirectly associated with EC2 instances, ENIs, or NAT gateways
FlexibilityCan be reassigned between instances to minimize downtime
AvailabilityHigh availability, IPV4 only, and regional allocation
CostFree while associated with a running instance; charged if unused

Conclusion

Elastic IPs in AWS provide versatility and stability for instances requiring constant public IP addresses. Their key functionalities and benefits make them indispensable for businesses operating dynamic and cloud-first architectures. To maximize the benefits of Elastic IPs, it is essential to manage their allocation wisely and ensure that they are considered in broader architecture and network designs.

By using Elastic IPs strategically, AWS users can ensure robust, fault-tolerant, and highly available applications, all critical components in today's cloud-driven landscape.


Related reading
Course
Beginner
27 lessons
10 hours
System Design Fundamentals

Build a strong foundation in designing scalable, reliable distributed systems.

View the course
Track what you have practised

A free account saves your progress, solutions and study plan across every problem on Codemia.

System Design practice on Codemia

Work through 120+ system design problems with detailed solutions, from rate limiters to multi-region storage.

Practice system design

All Rights Reserved.