DEV Community

Cover image for πŸ“ AWS 104: Never Change Your Address - Allocating an Elastic IP (EIP)
Hritik Raj
Hritik Raj

Posted on

πŸ“ AWS 104: Never Change Your Address - Allocating an Elastic IP (EIP)

AWS

🏑 Elastic IP: Your Server's Permanent Address in the Cloud

Hey Cloud Networkers and Stability Savants! πŸ‘‹

Welcome to Day 4 of the #100DaysOfCloud Challenge: Allocate Elastic IP! We’re diving deeper into AWS networking and tackling small, but mighty, steps in the migration plan from KodeKloud Engineer.

KodeKloud Engineer

We've set up our Key Pair, defined our firewall (Security Group), and carved out our network space (Subnet). But what happens if our server reboots? Its public IP address might change! That's where the Elastic IP (EIP) saves the day.


1. Introduction: Why Your Server Needs an Elastic IP πŸ’‘

By default, an EC2 instance launched into a public subnet receives a Public IP address. This address is dynamic, meaning it changes every time the instance is stopped and started. This is a nightmare for DNS records, client firewall rules, and third-party integrations!

  • What it is: An Elastic IP is a static, public IPv4 address designed for dynamic cloud computing.
  • Key Feature: Once allocated to your AWS account, it stays with your account, not with a specific server. You can instantly remap the EIP to any other instance in the same region.
  • Why it Matters: EIPs ensure that if a server fails, you can launch a replacement instance and assign the EIP to it immediately, achieving fast failover and maintaining continuous service under the same IP address.

Our task today is simply to allocate an EIP and name it datacenter-eip.

Let's secure our permanent address! πŸ“


2. Step-by-Step Guide: Allocating the Elastic IP via AWS Console

We will use the AWS Management Console within the EC2 Dashboard to allocate this static IP.

Step 2.1: Navigate to the EC2 Dashboard

Elastic IP addresses are managed under the EC2 service, as they are network resources.

  1. Log in to the AWS Console.
  2. In the AWS console search bar, type EC2 and click on the first result to open the EC2 Dashboard.

  1. In the left-hand navigation menu, scroll down to the "Network & Security" section and click on "Elastic IPs".

Step 2.2: Allocate the New Address

  1. Click the orange "Allocate Elastic IP address" button.

  1. On the allocation screen, you'll see a few options:
    • Network border group: Leave as the default (usually the region you are in, e.g., us-east-1).
    • Public IPv4 address pool: Select Amazon's pool of IPv4 addresses. (The default option, as you are not bringing your own IP.)

Step 2.3: Add the Name Tag

For easier management, we need to tag the EIP with the required name.

  1. Scroll down to the "Tags" section.
  2. Click "Add new tag".
  3. For the tag Key, type Name.
  4. For the tag Value, type the required name: datacenter-eip.

Step 2.4: Finalize Allocation

  1. Click the "Allocate" button at the bottom.

AWS will now provision a new, static public IP address and assign it to your account! You will see the new EIP listed in the Elastic IPs dashboard, ready to be associated with an EC2 instance. Great job! πŸŽ‰

3. Key Takeaways πŸ“

  • Static IP: EIPs provide a permanent, static IP address, unlike the default dynamic Public IP.
  • Fast Failover: You can instantly reassign an EIP to a new instance to handle outages.
  • Region-Specific: EIPs are tied to the region they are allocated in.

4. Common Mistakes to Avoid 🚫

  1. Billing Trap: AWS charges you for unassociated Elastic IP addresses. If you allocate one, make sure it is actively attached to a running instance or a network interface. If it sits unused, you incur a small fee!
  2. Forgetting the Tag: Always tag your EIPs, as required in this task. It's crucial for resource management and cost tracking.
  3. Cross-Region Use: You cannot associate an EIP from us-east-1 to an EC2 instance running in eu-west-1.

5. Conclusion + Call to Action! 🌟

You now control a critical piece of the networking puzzle: a static public address! This EIP will be essential for creating reliable connections to your application servers. Keep crushing the 100 Days of Cloud Challenge!

If you found this guide helpful, please:

  • πŸ’¬ Let’s connect on LinkedIn: Cloud, DevOps, consistency, and learning in publicβ€”let’s build together!
    πŸ‘‰ Hritik Raj

  • ⭐ Support my journey on GitHub: Follow my #100DaysOfCloud challenge with real AWS tasks and hands-on learning
    πŸ‘‰ GitHub – 100 Days of Cloud

Next up, we'll continue configuring the network, possibly attaching this EIP to a resource! Happy networking! πŸ’»

Top comments (0)