Your DNS is the service that translates your domain name into an IP address. AWS Route 53 is a smart DNS system that can dynamically change your origin address based on load, and even perform load balancing before traffic even reaches your servers.
Route 53 Integrates with AWS
If you’re running a small website, you likely have the free DNS service that came with your domain name provider, such as Namecheap or GoDaddy. If you’re running a large site, you might pay extra for a “premium” DNS provider, like Cloudflare or Dyn to get better lookup speeds (the time it takes to redirect a user) and faster propagation times (how long it takes for changes to your DNS configuration to take effect).
But both the free and premium DNS systems are, in a sense, “dumb,” compared to AWS’s offering. CloudFlare’s nameservers have no knowledge of your website running on a different service; all they do is provide a map of domain names to IP addresses, so users can make requests to your site.
This is where Route 53 outshines the competition (if you’re running on AWS, that is). Because AWS owns both the server and the DNS system, they’ve made the two play nicely together. For example, if your server experiences a crash, a regular DNS would continue to redirect users to the crashed server, because that’s what you told it to do. But Route 53 can perform health checks on your servers, and redirect users to a healthy resource while the problem is being fixed.
Route 53 can also prevent problems in the first place by acting similarly to a load balancer, but at the DNS level, by directing a certain percentage of traffic to different endpoints with predefined weights. This means that the traffic is balanced before the user even makes a connection, without going through a central load balancer.This can also be used for high-level A/B testing, by redirecting traffic to entirely different servers, which could display two different sites.
Route 53 also has integrations with AWS’s Elastic Load Balancer that allow you to map your DNS directly to your existing load balancer, without any additional lookups. Load balancers don’t have static IP addresses, just static hostnames; If you were to map an external DNS to an existing load balancer, users would need to first ask your DNS for the load balancer’s hostname, and then ask AWS’s DNS for the IP address of the load balancer. With Route 53, it’s all handled in one request.
Route 53 can also select the lowest latency endpoint you have, or a specific geographic location, and redirect users there. Really, you should also be using some sort of CDN (like AWS’s CloudFront) if you care about latency, but it’s a nice feature to have.
How Much Does Route 53 Cost?
Route 53 is fairly inexpensive, you simply pay:
$0. 50 per month for each domain (subdomains are free), $0. 50 per month for each server with a health check ($0. 75 for non-AWS servers), and $0. 40 per million queries, or $0. 60 per million queries if you have latency-based routing enabled.
However, even though you’re charged for each query, the total will likely be lower than expected. Lookups for Alias (A) records are free, and A records likely comprise most of what your DNS is actually serving. Plus, you’re charged per query, and not per-page-view; users will only need to look up your DNS once per session.
Setting Up Route 53
To set up Route 53, you’ll need to get your domain over to AWS. You can do this by transfering your domain, or if you’re just getting set up, you can buy it from AWS directly. Note that you may not be able to buy every top-level domain directly from AWS, such as .io.
From the Route 53 Management Console, select “Registered Domains,” and choose “Transfer Domain”:
Next, you’ll have to unlock your domain from your current provider. The exact method of this may vary, but most should have methods of transferring domains to other providers. The domain will be marked as transferrable, and you will be given an authorization code, which is the key that unlocks the domain.
If you see this error when attempting to transfer, you either haven’t unlocked the domain, or it hasn’t propagated yet. Or, you don’t own the domain in the first place.
Once the domain is transferable, you’ll be asked for the confirmation code, and the domain should transfer.
Once a new domain is available in your account, AWS will automatically create a hosted zone for you (note that this does cost $0.50 per month, or $6 per year, for each domain you have). This zone controls your domain settings, including all subdomains. Open the hosted zone and create a new record set to add a record.
You can create a standard A record to alias the domain to an IP address, or give a set of IP addresses and specify weights to balance between them based on latency and health checks. You can also alias a record directly to certain AWS services, such as a VPC endpoint or load balancer.
Once the changes propagate (should be no less than 60 seconds), you’ll be able to access your site through your domain as usual.