Configure DNS with Route 53
Jun 08, 2023 • 6 Minute Read
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.
BackgroundBefore 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 https://mywebsite.com is running.
- 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.
Configuring DNS with Route 53Note 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 AWS 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 zoneLog 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.
Step 2: Creating DNS RecordsClick 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.