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 issues you need to address is: my application/website servers are hosted on AWS, but how do 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 will look at how this process 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 in this process 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 then 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 nameservers (which you configured with your registrar) for mywebsite.com.
- Finally, it queries the nameservers 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 nameservers respond to queries for specific top-level domains and return the nameservers 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 keep the DNS provider as “GoDaddy,” but just as a proxy. We can use AWS nameservers for resolving your host IP.
Configuring DNS with Route 53
Note that the steps we discuss 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 move forward:
“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 migrate 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 will see a form on the right side of the page.
Input the following information into the fields:
- Domain Name: Your domain name; in our example, mywebsite.com.
- Comment: You can enter whatever you like here.
- Type: Choose depending on what type of availability this zone should be. The default will be “Public Hosted Zone”, which means it can be accessed from the internet. “Private Hosted Zones” are accessible from within AWS VPC and are not available to the public internet.
This step will, by default, create two entries in your hosted zone: NS (nameserver) and SOA (start of authority) records. Take note of the NS (name server) entries. In the next step, we’ll configure these with GoDaddy.
Step 2: Creating DNS Records
Click on the newly created hosted zone, which takes you to the “hosted zone details” screen. Click on Create a Resource Record and you’ll see a new form.
Select appropriate values for the following:
- Name: Leave empty if you’re not configuring a subdomain.
- Type: Refer to GoDaddy to find out what your current type is and use the same value here. For setting up a basic website, this will most likely be A or AAAA.
- Alias: Pick an 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 the default. But if you want a different routing policy, you may refer to the AWS documentation to understand which one to pick based on the scenario.
Step 3: Managing DNS Settings with your Domain Registrar
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 nameserver, the Amazon nameserver that hosts your records will be returned. This allows users to resolve the domain for your website or application.
Log in to the GoDaddy console, navigate to your domains, then click Manage for the domain you want to configure. Next, 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 when 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.
We’ve got new AWS Courses, Hands-on Labs, and Practice exams/Quizzes coming with The Great 200+ in November! Join the celebration in our live shows! See the schedule here.