How to map domain name to Amazon AWS EC2 instance - Little Big Extra Skip to main content

How to map domain name to Amazon AWS EC2 instance

Map domain name from GoDaddy to Amazon EC2 instance.


If you want to associate your domain name with Amazon EC2 instance for which provider is different than Amazon Route 53 like GoDaddy, BlueHost etc.The easiest way is to do IP address forwarding where you just forward the incoming requests to Elastic IP provided by Amazon, however, the drawback of this approach is that there will always be an extra redirect and a forward.A better approach is to amend the registrar (where you bought the domain name) with Amazon NameSpace servers details.

In this tutorial, we are going to

  • Create hosted zone
  • Create recordset with domain and subdomains
  • Add amazon namespace servers in the domain provider console

Get Elastic IP and Assign it to Amazon instance

  1. The first thing you need to do is get an Elastic IP, the instance IP can change during reboot etc but elastic IP are static IP’s so you should make sure you create one of them and assign it your running instance.More detailed info can be found here.

Create Hosted Zone and Record Sets

  1. Go to Amazon AWS -> services and select Route 53
  2. Click on Hosted Zones and create a hosted zone.
    1. Give the domain name you have bought, make sure that you don’t add www. to it.
    2. Any comment if you like
    3.  Select type as Public Hosted Zone.Create Hosted Zone
  3. You should see something like below on your screen, Name Space servers, usually there are 4 different entries.Make note of these as you need them in the last step.Add Record Set
  4. Now Create a recordset and add values as shown in image below
    1. Keep name field empty
    2. Type  as A
    3. Alias as No
    4. Value – This should be the value of your elastic IP
    5. Routeing Policy: Simple
      Edit Elastic IP
  5. Now we need to bring subdomain too, so should also work
    1. In name field type www.
    2. Type  as A
    3. Alias as Yes
    4. Alias Target from dropdown select your site name
    5. Routeing Policy: Simple
      Add SubDomain

Add the Amazon NameSpaceServers in Control panel of Domain Provider

  1. Now go to GoDaddy domain console and under my domains, click on settings.
  2. Change the Namespace servers (you should see 2 servers name)  from default to custom.
  3. Add all the 4 namespace servers you got in STEP 4, add them one by one. Save it and wait for a couple of minutes. Type your domain name in the browser and you should be redirected to your website.

Follow this Video

13 thoughts to “How to map domain name to Amazon AWS EC2 instance”

  1. Hi
    I followed the steps as described, but it’s not working. Does it take time? How do I trouble shoot?


  2. Thanks Abhishek, this was helpful!

    I will check back in future, to see more of your posts that may help me as a web developer.

  3. Hi thanks for the tutorial.
    It worked for me, but after the page loaded, the address in the address bar change into the one that ec2 has, how we keep use the domain instead of the ec2 ip.

  4. Hi,

    Do I need to remove Godaddy NameSpaceServers completely and keep only the AWS that I got?

    This is what I did and it’s not working for me.

Leave a Reply

Your email address will not be published. Required fields are marked *