Skip to main content

Command Palette

Search for a command to run...

Attach Elastic/Static IP to an EC2 Instance in AWS

Published
3 min read
Attach Elastic/Static IP to an EC2 Instance in AWS

What is an IP Address?

An IP (Internet Protocol) address is a unique address for devices (like your computer or a server) to communicate over the internet. Think of it like a phone number for computers.

Why Elastic IP Addresses?

In cloud computing with AWS, when you create a virtual server (EC2 instance), it gets an IP address. However, this IP address might change if you stop and restart the server. Elastic IP addresses solve this problem by providing a static IP address that doesn't change.

Elastic IP Address in AWS

Elastic IP Address: A unique, static IP address in AWS designed for dynamic cloud computing. It stays the same even if you stop and restart your instance.

Real-Life Uses of Elastic IPs in AWS:

  1. Hosting a website:

    • Ensure your website has a consistent address. Even if you replace the instance, your users won't see any change in the website's location.
  2. Running Applications:

    • For applications that need a fixed IP address for security or integration purposes. You can move the IP if you upgrade or replace your servers.
  3. Failover and Redundancy:

    • Crucial for setting up backup mechanisms. If your main server fails, quickly redirect the Elastic IP to a backup server to keep services running.

How to Allocate and Manage Elastic IP Addresses

Allocate an Elastic IP Address

  1. Log in to the AWS EC2 Console:

  2. Navigate to Elastic IPs:

    • In the left navigation pane, click on "Network & Security" and then "Elastic IPs."

  3. Allocate Elastic IP:

    • Click "Allocate Elastic IP address."

    • Choose the type of address pool (e.g., Amazon's pool of IPv4 addresses).

    • (Optional) Select a network border group.

    • Click "Allocate."

Associate Elastic IP with an EC2 Instance

  1. Navigate to Elastic IPs in the EC2 Console:

  2. Select and Associate:

    • Select the Elastic IP address you want to associate.

    • Click "Actions" and choose "Associate Elastic IP address."

    • For Resource type, choose "Instance."

    • Select the instance to associate with the Elastic IP.

    • (Optional) Specify a private IP address.

    • Click "Associate."

Disassociate an Elastic IP Address

  1. Go to Elastic IPs:

    • Open the EC2 console and navigate to "Elastic IPs."
  2. Select and Disassociate:

    • Select the Elastic IP address you want to disassociate.

    • Click "Actions" and choose "Disassociate Elastic IP address."

    • Click "Disassociate."

Release an Elastic IP Address

  1. Navigate to Elastic IPs:

    • Open the EC2 console and go to "Elastic IPs."
  2. Select and Release:

    • Select the Elastic IP address to release.

    • Click "Actions" and choose "Release Elastic IP addresses."

    • Click "Release."

Conclusion

Elastic IP addresses in AWS provide a stable IP address that remains constant even if you restart your instance, making them perfect for hosting websites, running applications requiring fixed IPs, and setting up failover mechanisms. By following the steps above, you can easily allocate, associate, disassociate, and release Elastic IP addresses in your AWS environment.

Happy cloud computing! 🌐💻


More from this blog

DevOps journey

34 posts

In this DevOps journey, we’ll explore a range of DevOps tools and related projects.