Use AWS Elastic IP Address

2020/4/92 min read
bookmark this
Responsive image

This blog will show how to use AWS elastic IP to assign to EC Instance but before that...

Why do you need to use an elastic IP address?

Assume you have the following EC2 had set up, you use your EC2 as a web server and the public IP address is as follows.

Now, if you stop your instance and start again. The EC2 instance public IP address changed! So this could an issue if you need to know this server's IP address for processing something else. You could use EC2 instance metadata to log the IP address somewhere, like using Lambda, or you could use elastic IP address I will show later.

Following is how you use AWS elastic IP address.

Choose Elasti IPs via EC2 page

Allocate Elastic IP address

Click Allocate

After allocating an IP address, you will get a new IP address as follows.

Associate Elastic IP address

 Now, here we need to associate the elastic IP address to the EC2 instance.

EC2 public IP address change to elastic IP address

Now, the elastic IP address had associated with your specific EC2 instance, whenever you stop EC2 instance the public instance will keep the same IP address.

How much is Elastic IP address?

It is free based on the AWS document at this point, as long as the elastic IP address is assigned to any instance is free, so if your elastic IP address is not assigned to anything it will be a charge.

Reference to AWS document for more detail about Elastic IP charge.