DEV Community

Cover image for How to Add an Elastic (Static) IP to Your EC2 Instance And Update Your DNS Records on Route53
1

How to Add an Elastic (Static) IP to Your EC2 Instance And Update Your DNS Records on Route53

Assigning an Elastic IP to Your EC2 Instance

Once your EC2 instance is up and running, the next step is to assign an Elastic IP address to it. This ensures your instance has a static public IP, which remains consistent even if the instance is stopped and started. This is crucial for maintaining a reliable connection to your application or website.


What is an Elastic IP?

An Elastic IP is a static IPv4 address designed for dynamic cloud computing. It allows you to associate a persistent IP address with your EC2 instance, enabling seamless connectivity without worrying about changing IP addresses.


Benefits of Using an Elastic IP:

  1. Static Public IP: Provides a fixed IP that won’t change, making it easy to set DNS records.
  2. High Availability: You can quickly remap the Elastic IP to another instance if needed, ensuring minimal downtime.
  3. Cost-Effective: It's free as long as it’s associated with a running instance.

Steps to Add an Elastic IP to Your EC2 Instance:

Allocate an Elastic IP

  1. Go to the EC2 Dashboard in the AWS Management Console.
  2. In the left-hand menu, select Elastic IPs.
  3. Click on Allocate Elastic IP address.
  4. Select Amazon's pool of IPv4 addresses.

Associate the Elastic IP with Your Instance

  1. Click Allocate.
  2. Click Associate this Elastic IP address.
  3. Choose Your Instance from the dropdown.
  4. Optionally, specify a private IP address if your instance has multiple private IPs.
  5. Click Associate

Update Your DNS Records

Once the Elastic IP is associated, update your DNS records in Route 53 to point your domain to the new Elastic IP.

  1. Go to the Route 53 dashboard.
  2. Select your hosted zone.
  3. Edit or create an A record to use the Elastic IP.

Verification:

To confirm everything is working:

  1. Open a browser and type your domain name.
  2. You should see your application or website resolving correctly.

Now that your EC2 instance has a static public IP, your application is better equipped for reliable and consistent access, and you can stop your instance, update your user data without losing your IP!

Check out: Student Analyst to observe the steps in this series.

Image of Timescale

🚀 pgai Vectorizer: SQLAlchemy and LiteLLM Make Vector Search Simple

We built pgai Vectorizer to simplify embedding management for AI applications—without needing a separate database or complex infrastructure. Since launch, developers have created over 3,000 vectorizers on Timescale Cloud, with many more self-hosted.

Read more

Top comments (0)

Best Practices for Running  Container WordPress on AWS (ECS, EFS, RDS, ELB) using CDK cover image

Best Practices for Running Container WordPress on AWS (ECS, EFS, RDS, ELB) using CDK

This post discusses the process of migrating a growing WordPress eShop business to AWS using AWS CDK for an easily scalable, high availability architecture. The detailed structure encompasses several pillars: Compute, Storage, Database, Cache, CDN, DNS, Security, and Backup.

Read full post

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay