Connect Domain Name with AWS EC2 Instance using AWS Route 53

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.

* To connect AWS with the domain we will have to use a service called Route53 (53 refers thee TCP/UDP port 53 for DNS serving). And also there won’t be any direct way to do without this service. You can use any AWS public gateway provider such as EC2, ELB, S3 to serve your website or server to the public domain you have on GoDaddy. The AWS usually charges about .51 USD per month to maintain this zone entry as well. [3]

In this tutorial, we are going to
  • Create hosted zone
  • Create record set 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.

Create an elastic IP for the EC2 instance you are integrating.

  1. Click Allocate new address in the Elastic IP's page.
  2. Then, click Allocate in the next page.
  3. Right-click the row of the newly created elastic IP, and click Associate address.
  4. Choose the EC2 instance you are integrating


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.
  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.
  4. Now Create a record set 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
  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 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.
You can see the steps visually watching the video below:
 https://www.youtube.com/watch?v=pjA9MyzUJNQ&feature=emb_logo



References:

[1] How to map domain name to Amazon AWS EC2 instance

[2] Connecting an EC2 instance with a GoDaddy Domain

[3] How to host GoDaddy domain with AWS EC2 

Yorumlar