Introduction

If you're hosting applications or websites on AWS, you might need a fixed IP address for your EC2 instance. Elastic IP (EIP) is useful in this case because it stays the same even when you stop or start the instance. An Elastic IP is a static IPv4 address that can be linked to your EC2 instance. The advantage is that you can move the Elastic IP to another instance without changing the IP address your users use.

Steps to Attach an Elastic IP to an EC2 Instance

Let's go step by step to attach an Elastic IP to your EC2 instance.

Step 1. Allocate an Elastic IP

Before attaching an Elastic IP to your EC2 instance, you need to first create one.

Step 2. Associate the Elastic IP with Your EC2 Instance

Now that you have your Elastic IP let’s attach it to your EC2 instance.

Your EC2 instance now has a fixed IP address. You can use this Elastic IP for connecting to the instance or making your web application publicly accessible.

Step 3. Verify the Connection

To make sure everything is working correctly.

Why use an Elastic IP?

Note. Remember, you are charged for Elastic IPs if they are not associated with a running instance. If you no longer need the Elastic IP, it’s a good idea to release it to avoid any extra charges.

To release an Elastic IP.

Conclusion

Attaching an Elastic IP to your EC2 instance is a straightforward process that ensures your EC2 instance has a static IP address. Whether you're running a website, a database, or any other application, an Elastic IP gives you the consistency you need. Just follow these steps, and you'll have your Elastic IP set up in no time.