EC2 Elastic IP

In the world of the internet, every device (like your computer or a server) needs a unique address to communicate with other devices. This address is called an IP (Internet Protocol) address. Think of it as a phone number for computers.

Now, in cloud computing, when you create a virtual server (like on Amazon Web Services), it also gets an IP address. However, this IP address might change if you stop and restart your server. Here's where Elastic IP addresses come into play.

Elastic IP Address in AWS:

An Elastic IP address in AWS is a unique, static IP address designed for dynamic cloud computing. When you launch a virtual server (an EC2 instance) on AWS, it's given an IP address. However, this IP address can change if you stop and start your instance. Elastic IPs are a way to overcome this limitation.

Use in Real Life (Specific to AWS):

  1. Hosting a Website: If you host a website on an EC2 instance, using an Elastic IP ensures your website has a consistent address. Even if you replace the instance, your users won't notice any change in the website's location.
  2. Running Applications: For applications that require a fixed IP address (for security reasons or integration purposes), Elastic IPs provide a stable solution. You can move the IP if you upgrade or replace your servers.
  3. Failover and Redundancy: Elastic IPs are crucial for setting up failover mechanisms. If your main server fails, you can quickly redirect the Elastic IP to a backup server, ensuring continuous service availability.

Allocate Ip Address

To allocate an Elastic IP address from Amazon's pool of public IPv4 addresses or from a custom IP address pool, follow these steps:

  • Open the Amazon EC2 console at https://console.aws.amazon.com/ec2/
  • In the navigation pane, choose Network & Security, Elastic IPs.
  • Choose Allocate Elastic IP address.
  • Choose the type of address pool: Amazon's pool of IPv4 addresses, Public IPv4 address that you bring to your AWS account, or Customer owned pool of IPv4 addresses.
  • (Optional) Choose a network border group for the Elastic IP address.
  • Choose Allocate.

Associate Elastic IP address to An EC2 Instance

  • Open the Amazon EC2 console at https://console.aws.amazon.com/ec2
  • In the navigation pane, choose Elastic IPs.
  • Select the Elastic IP address to associate and choose Actions, Associate Elastic IP address.
  • For Resource type, choose Instance.
  • For Instance, choose the instance with which to associate the Elastic IP address. You can also enter text to search for a specific instance.
  • (Optional) For Private IP address, specify a private IP address with which to associate the Elastic IP address.
  • Choose Associate.

You can disassociate an Elastic IP address from an instance or network interface at any time. After you disassociate the Elastic IP address, you can reassociate it with another resource.

You can disassociate an Elastic IP address using one of the following methods.

  • Open the Amazon EC2 console at https://console.aws.amazon.com/ec2/.
  • In the navigation pane, choose Elastic IPs.
  • Select the Elastic IP address to disassociate, choose Actions, Disassociate Elastic IP address.
  • Choose Disassociate.

Release an Elastic IP address

If you no longer need an Elastic IP address, we recommend that you release it using one of the following methods. The address to release must not be currently associated with an AWS resource, such as an EC2 instance, NAT gateway, or Network Load Balancer.

  • Open the Amazon EC2 console at https://console.aws.amazon.com/ec2/.
  • In the navigation pane, choose Elastic IPs.
  • Select the Elastic IP address to release and choose Actions, Release Elastic IP addresses.
  • Choose Release.