Build awareness and adoption for your software startup with Circuit.

Assigning a Domain Name to an AWS EC2 Instance via Elastic IP

A comprehensive guide to assigning a domain name via Elastic IP and verifying DNS resolution

Figure 1.1 Assigning a domain name to an AWS EC2 Instance

Hey there! If you’re looking for a way to easily access your Amazon EC2 instance using a memorable and user-friendly URL. For that, you can assign a domain name to it using an Elastic IP. It’s a convenient solution that we’ll guide you through step by step.

In this step-by-step guide, we will walk through the process of assigning a domain name to an EC2 instance via Elastic IP. By the end of this tutorial, you will have your domain name successfully linked to your EC2 instance.


Before we proceed, ensure that you have the following prerequisites:

  1. An active Amazon Web Services (AWS) account.
  2. An EC2 instance running and accessible.
  3. A registered domain name (e.g., with a domain registrar.

Step 1: Allocate an Elastic IP

  1. Go to the AWS Management Console and navigate to the EC2 Dashboard.
  2. From the navigation bar, click on “Elastic IPs” under “Network & Security.”
  3. Click on “Allocate new address” and choose “Amazon’s pool of IPv4 addresses.”
  4. Click on “Allocate” to create a new Elastic IP.

Step 2: Associate the Elastic IP with your EC2 Instance

  1. From the Elastic IPs list, select the newly allocated Elastic IP.
  2. Click on “Actions” and choose “Associate IP address.”
  3. In the “Associate Elastic IP address” dialog, select your EC2 instance from the drop-down menu.
  4. Click on “Associate” to link the Elastic IP with your EC2 instance.

Step 3: Update DNS Records with your Domain Registrar

  1. Log in to your domain registrar’s website (where you registered your domain).
  2. Locate the DNS management settings for your domain.
  3. Add an “A” record with a blank or “@” hostname, pointing to the Elastic IP address you just associated with your EC2 instance.
  4. Save the changes to update your DNS records.

Step 4: Wait for DNS Propagation

After updating your DNS records, it may take some time for the changes to propagate across the internet. DNS propagation typically takes a few minutes to several hours, depending on various factors such as TTL (Time to Live) settings and caching.

Step 5: Verify Domain Name Resolution

  1. Open a web browser and enter your domain name (e.g., in the address bar.
  2. If everything is configured correctly, your website or application hosted on the EC2 instance should load successfully.

Step 6: Check Domain Resolution with NSlookup

  1. Open a terminal or command prompt on your local machine.
  2. Type the following command, replacing “” with your domain name:
  1. Press Enter to execute the command.

NSlookup will display domain information, including the resolved IP address. Check that the resolved IP address corresponds to the Elastic IP address associated with your EC2 instance. If the IP address matches, it means the DNS records were correctly propagated and your domain name is resolving to the correct IP address.

Remember that DNS propagation can take some time, so if the IP address doesn’t match right away, wait a few minutes and try the NSlookup command again later.


You have successfully allocated a domain name to your Amazon EC2 instance using an Elastic IP by following this step-by-step guide. You may now access your EC2 instance with a more user-friendly URL, which improves the accessibility and visibility of your application or website. Remember to check your DNS settings on a regular basis and renew your Elastic IP as needed to preserve seamless access to your EC2 instance via your domain name. An NSlookup adds another layer of assurance that your domain name setting is operational.

Continue Learning