Skip to main content

How to map domain name to Amazon AWS EC2 instance

Map domain name from GoDaddy to Amazon EC2 instance.

Introduction

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 www.yourdomain.com 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

Leave a Reply

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

Bitnami