If you are a website owner who bought a domain from GoDaddy (or some other registrar) and started exploring AWS to take advantage of the capabilities of cloud computing, one of the things you need to address will be: my application/website servers are hosted on AWS, so how can I integrate with the domain I bought from GoDaddy?
The easiest answer is to update your GoDaddy NS records to point to Amazon’s name servers. In this tutorial, we are going to look at how this setup works.
Note that we’ll be looking at GoDaddy so that we have a specific example, but this process will be very similar no matter where you bought your domain name.
Before we jump into action, let’s try to understand a few basic components involved and how they work together.
Let’s assume you’re the owner of the domain mywebsite.com. In a typical setup, here’s what happens when the user types your website URL in their browser:
- The browser queries the Domain Name System server for your domain’s IP address. Note that, while figuring out which DNS server to use, the order of lookups is:
- Local cache
- Local area network
- ISP-level cache servers
- Authoritative DNS servers
- The browser queries the authoritative DNS name servers (root servers) to find out “top level domain” (TLD) name servers for .com domains
- Next, the browser queries TLD name servers to get the name servers (which you configured with your registrar) for mywebsite.com
- Finally, it queries the name servers to get the IP address(es) of the hosts where http://mywebsite.com is running
To review, the primary components involved are:
Root name servers – These respond directly to requests for records in the “root zone,” but they can also answer other requests with a list of TLD name servers
TLD name servers – These name servers respond to queries for specific top level domains, and return the name servers for a given FQDN (fully qualified domain name)
Name servers for the domain – Within a top level domain, there might be millions of FQDNs. Each of these will be distributed among a network of name servers, which respond to requests for the specific domain a user wants to access
Now if we put this information within the context of what we are trying to achieve, the new flow would be: keep the DNS provider as “GoDaddy,” but just as a proxy. We can use AWS name servers for resolving your host IP.
Configuring DNS with Route 53
Note that the steps we are discussing here are for “simple” DNS configurations, such as hosting a basic website or application. If your current DNS setup is complex, the steps might be slightly different.
AWS documentation has a statement that’s worth looking over before we begin:
“When you migrate DNS service from another provider to Route 53, you reproduce your current DNS configuration in Route 53. In Route 53, you create a hosted zone that has the same name as your domain, and you create records in the hosted zone. Each record indicates how you want to route traffic for a specified domain name or subdomain name.”
In a simple scenario, you will be migrating one or a combination of the following things from your current DNS provider (in our example, GoDaddy) to AWS:
- A (Address) records – Associate a domain name or subdomain name with the IPv4 address (for example, 192.0.2.3) of the corresponding resource
- AAAA (Address) records – Associate a domain name or subdomain name with the IPv6 address (for example, 2001:0db8:85a3:::abcd:0001:2345) of the corresponding resource
- MX (Mail server) records – Route traffic to mail servers
- CNAME records – Reroute traffic for one domain to another domain
Step 1: Creating a hosted zone
Log in to the AWS Management Console and navigate to the Route 53 menu. Then click on Create a Hosted Zone.
Once you create a zone, you’ll see this form on the right side of the page:
Input the following information into these fields:
- Domain Name: Your domain name; in our example, mywebsite.com
- Comment: You can enter whatever you like here
- Type: Depending on what type availability this zone should be, you need to pick. The default will be “Public Hosted Zone”, which means can be accessible from the internet. “Private Hosted Zones” are accessible from within AWS VPC and not available to the public internet.
This step will, by default, create two entries in your hosted zone: NS (name server) and SOA (start of authority) records. You should see something like this:
Take note of the NS (name server) entries. In the next step, we’ll configure these with GoDaddy. The steps will be similar for other domain registrars.
Step 2: Creating DNS Records
Click on the newly created hosted zone, which will take you to “hosted zone details” screen. Click on Create a Resource Record, and you’ll see a new form to add records:
Select appropriate values for the following:
- Name: Leave empty if you’re not configuring a subdomain
- Type: This value you can refer GoDaddy to find out what your current type and use same value here. For setting up a basic website, this will most likely be A or AAAA.
- Alias: Pick appropriate value. More information on what to pick (and when) is available in this section of AWS documentation
- Value/Alias Target: Based on Alias Yes (or) No, you will either point to an IP address or some other Alias entry.
- Routing Policy: “Simple” is default. But if you want different routing policy, you may refer to the AWS documentation to understand which one to pick in different scenarios.
In this step, we’re mapping our domain to our server. Going back to our list of the three components of DNS lookup, this mapping helps at the final level. After a request is made to the TLD name server, the Amazon name server that hosts your records will be returned, which allows users to resolve the domain for your website or application.
Step 3: Managing DNS Settings with your Domain Registrar
Log in to GoDaddy console, navigate to your domains, and click Manage for the domain you want to configure:
Then click Manage DNS under the Additional Settings section (this will be at the bottom of the page).
Click on Add (in the Records section at the top of the page) and set the type to NameServer. In the Host field, enter your domain name. In the Points to field, enter one NS IP address from Step 1, where you configured the AWS Hosted Zone record.
Repeat this process to add each NS record from the hosted zone in Step 1.
That’s it! Your configuration is done, now all you need to do is allow some time to have these settings propagated.
These same principles will be applicable for cases where you want to leave root domain with GoDaddy, but have subdomains DNS on AWS. Apart from “delegation (or) proxying” DNS to AWS, another approach is “transfer the registration”. AWS documentation on Transferring Registration for a Domain to Amazon Route 53 has details about how to do this.
For more information about how to make the best use of the AWS cloud, check out the INVOKE Cloud website!