Attach an Elastic IP Address to AWS EC2 Instance

Assign a static IP address to AWS EC2 instance with AWS Elastic IPs

Elastic IP addresses from AWS are a product with great usability. It has many use cases. One of them being having the ability to have an static IP address for your EC2 instance. It is a must use feature if you’re planning to use EC2 instance as a web server. This tutorial will show you how to attach an Elastic IP Address to AWS EC2 Instance.

EC2 Instances are assigned with a dynamic public IP address when they are being created. This address will continue to work until the instance is active in your account. And it’ll be released if you stop your instance. A new address will be assigned when the instance starts again. This will cause your websites to go offline unless you update DNS with the new public address. This can be avoided by using an Elastic IP Address.

An Elastic IP Address is a static IP address assigned to your account. The dynamic public IP address will be replaced with this address when you attach an Elastic IP address to AWS EC2 Instance. And your websites will continue to work even after hard reboots of your instance.

That’s just a one use case of Elastic IP Addresses. There are more use cases. This become very useful when using Virtualmin. Virtualmin hardcode IP address to its services. Getting Virtualmin to work with a new IP address isn’t as simple as updating DNS settings. So assigning an elastic IP address to your instance can save you some trouble and few hours in the future.

How to Attach an Elastic IP Address to AWS EC2 Instance

Scroll down to Network and Security section from left sidebar on your EC2 dashboard. Then click Elastic IPs. First thing you need to do is to assign an IP address to your account. Do it by clicking Allocate New Address button and follow the instructions.

Allocated addresses will be displayed on your Elastic IP dashboard. You can assign them to EC2 instances from Actions menu, by clicking Associate addresses.

associate elastic ip address

It’ll take you to a screen where you can select an instance and private IP address. The private IP address can be found on EC2 instance details. This will not change your private IP address. It’ll be the same, but the current public address of your instance will be released.

associate elastic ip address 2

Elastic IP addresses you allocate to your account will be in your account even if you terminate the instances they are associated with. And they will be free as long as they are associated with an instance. Unassociated elastic IP addresses and additional Elastic IP addresses assigned to an instance will be charged according to EC2 Pricing.

You’re one step closer to installing Virtualmin on your EC2 instance when you attach an Elastic IP Address to AWS EC2 Instance. Next step is to convert PEM key file you download when creating EC2 instance and login in to AWS instance over SSH.

Tharindu

Hey!! I'm Tharindu. I'm from Sri Lanka. I'm a part time freelancer and this is my blog where I write about everything I think might be useful to readers. If you read a tutorial here and want to hire me, contact me here.

Related Articles

Leave a Reply

Your email address will not be published.

Back to top button

We use cookies to give you the best online experience. By agreeing you accept the use of cookies in accordance with our cookie policy.