How To Point or Map a Domain Name to AWS EC2 Server Instance

point domain name to ec2 instance

In this blog, you will learn to point domain name to ec2 instance using the step by step guides.

Map a Domain Name to AWS EC2 Server

If you bought a domain name from providers like Godaddy, Bluehost, Namecheap, etc, other than AWS Route53, you might have their own name server configured in the DNS settings.

Now that you have your website on the AWS EC2 instance, mapping the domain name to the EC2 instance can be done in two ways.

  1. Mapping A record of the DNS records to an EC2 IP address (ec2 elastic IP).
  2. Create a Hosted Zone in Route 53 and map the domain address. (Will cost you $0.53 /month per hosted zone)

Method 1: Mapping Domain Name Using A Record

The easiest option is to map a domain name to an ec2 instance is by adding the elastic IP of the instance as an A record in the DNS settings.

Here is an example of an A record-setting on Godaddy.

Adding A record as ec2 elastic IP address.

Method 2: Mapping Domain Name Using Route53

Follow the steps carefully for setting up the domain name using Route53.

Note: Back up your current DNS file of your domain name providers. Also, make note of any custom DNS records that points to other mail servers.

Step 1: Head over to the AWS management console.

Step 2: Under services –> Networking,  find Route 53 service and navigate to the Route 53 page.

Step 3: Click the “create hosted zone” option.

route53 hosted zone creation

Step 4: Click the “Get started” option under DNS management.

route53 get started

Step 5: Click the “create hosted zone” option and enter your domain details. For example, if your domain name is example.com, provide example.com in the domain name text box. Comment is some arbitrary description for your hosted zone. Leave the “type” as “public hosted zone

hostedzone-domain-name

Step 6: Once the hosted zone is created, you can see four Nameserver details in the NS row as shown below.

AWS Name servers Route53

Step 7: Replace the existing Nameserver entries in your domain name provider with the AWS NS values from your hosted zone.  The DNS changes will take up to 48 hours to get propagated all over the world. Mostly you will see the changes in a short time.

Step 8:   Create an A record using the “create record set” option in route53 and assign the elastic IP of your ec2 instance which hosts your website.  This will point the domain name to your website.

Conclusion

In this blog, I have added two methods to point a domain name to an ec2 instance.

For the production server, make sure you add an elastic IP to the ec2 instance and use it with the domain name settings.

Leave a comment below or contact [email protected] for more help.

0 Shares:
2 comments
  1. Thanks a lot. The simplest way to solve my issue was to find your post and follow it. Easier than the documentation I found in AWS.

    Kudos

  2. i went to host my website using ec2 on wordpress and i have been also uploaded my html file and also change the name server yet it is not working . please help me because i am doing a ojb and my boss said to me to do that but i could not do since 15days

Leave a Reply

Your email address will not be published.

You May Also Like