We begin the chapter on content delivery and DNS: how users reach your application quickly, reliably, and securely. The first piece is DNS, the "phone book of the internet," which in AWS is managed by the Route 53 service. Without DNS, the internet would be a chaos of numbers impossible to remember.

What is DNS (quick review)

When you type www.google.com in your browser, your computer doesn't know where that site is: it needs an IP address (a number like 142.250.184.4). The DNS (Domain Name System) is the system that translates domain names into IP addresses.

   www.mywebsite.com  ──(DNS)──►  52.48.123.45
   (what you remember)           (what the network needs)

Analogy: DNS is like your phone's contact list. You call "Mom," you don't memorize her phone number. The contact list translates the name into the real number. DNS does the same with websites: you remember mywebsite.com, and DNS translates it to the server's IP.

What is Route 53

Route 53 is AWS's DNS service (the "53" comes from the port DNS uses). With it you can:

  • Register domains (buy myshop.com).
  • Manage the DNS records of your domains.
  • Intelligently route traffic to your resources (with the routing policies we'll see).

It's the gateway for users to your application.

Types of DNS records

A domain has several records, each with a function. These are the ones you need to know:

Record What it's for Example
A Points a name to an IPv4 address mywebsite.com → 52.48.123.45
AAAA Points to an IPv6 address mywebsite.com → 2600:1f...
CNAME Points a name to another name (alias) www.mywebsite.com → mywebsite.com
MX Indicates the domain's mail servers (to receive emails)
TXT Free text (verifications, security) (validate ownership, SPF...)
NS Indicates the domain's DNS servers (delegation)

The two most common in day-to-day use are A (name → IP) and CNAME (name → another name).

The special "Alias" record in AWS

Route 53 adds a very useful proprietary type: the Alias record. It's similar to a CNAME, but designed to point directly to AWS resources (a load balancer from Chapter 13, a CloudFront distribution, an S3 bucket...). It has advantages: it works at the root of the domain (where a CNAME can't) and has no additional query cost.

mywebsite.com  ──(Alias record)──►  my-load-balancer (ALB)

To start: use A/Alias records to point your domain to your AWS resources (a load balancer, CloudFront). This is the most common.

Routing policies: directing traffic intelligently

Here's what makes Route 53 special. It doesn't just translate names: it can decide which IP to respond with according to different criteria, using routing policies.

Simple

The basic one: one name → one address. No additional logic. For most simple websites, this is enough.

Weighted

Distributes traffic among several destinations according to percentages you define. Ideal for gradual deployments.

mywebsite.com → 90% to the current version server
              → 10% to the new version server

Example: you want to test a new version of your website with a few users before launching it to everyone (a "canary"). You send 10% of the traffic to the new version; if all goes well, you increase the percentage. This is called a canary deployment.

Latency-based

Sends each user to the server that gives them the lowest latency (the fastest for them), usually the geographically closest. Recall the concept of latency from Chapter 3.

User in Europe  → server in Ireland (fast for them)
User in Japan   → server in Tokyo (fast for them)

Geolocation

Sends users to a destination according to their country or region. Useful for showing localized content or complying with regulations.

Users from Spain   → website in Spanish
Users from France  → website in French

Failover

Has a primary and a backup destination. If the primary fails (detected with a health check, we'll see this in subchapter 16.4 and in Chapter 26), Route 53 automatically redirects to the backup.

mywebsite.com → primary server (if healthy)
              → backup server (if the primary fails)

This is key for high availability (Chapter 26).

Routing policies summary table

Policy What it does Use case
Simple One name → one IP Simple websites
Weighted Distributes by percentages Canary/gradual deployments
Latency To the fastest server Global apps (lower latency)
Geolocation By user's country Localized content, regulations
Failover Primary + backup High availability

What you should remember

  • DNS translates domain names into IP addresses (the "contact list" of the internet); Route 53 is AWS's DNS service and the gateway to your application.
  • Key records: A (name → IPv4), CNAME (name → another name), and AWS's Alias (points to AWS resources like load balancers or CloudFront, with no extra cost).
  • Routing policies direct traffic intelligently: Simple, Weighted (percentages, canary deployments), Latency (fastest server), Geolocation (by country), and Failover (primary + backup for high availability).
  • To start: A/Alias records pointing to your AWS resources, with Simple policy.

In the next subchapter, we'll see how to accelerate the delivery of your content to users around the world with the CloudFront distribution network.

Cloud, AWS & Terraform — From Zero to Expert

Chapter 1 · What is cloud computing

Chapter 2 · The cloud market and major providers

Chapter 3 · Regions, availability zones and edge

Chapter 4 · Compute: EC2

Chapter 5 · Storage: S3

Chapter 6 · Networking: VPC

Chapter 7 · Identity and access: IAM

Chapter 8 · Managed databases

Chapter 9 · Why Infrastructure as Code

Chapter 10 · HCL: the Terraform language

Chapter 11 · Providers and state

Chapter 12 · Your first real infrastructure in Terraform

Chapter 13 · Load balancing and auto scaling

Chapter 14 · Serverless with Lambda

Chapter 15 · Messaging and events

Chapter 16 · Content delivery and DNS

Chapter 17 · Containers on AWS

Chapter 18 · Modules: reuse and composition

Chapter 19 · Workspaces and environment management

Chapter 20 · Remote backends and locking

Chapter 21 · Infrastructure testing

Chapter 22 · Terraform in CI/CD

Chapter 23 · Defense in depth

Chapter 24 · Observability: logs, metrics and traces

Chapter 25 · Cost optimization

Chapter 26 · High availability and disaster recovery

Chapter 27 · AWS Well-Architected Framework

Chapter 28 · Serverless architectures at scale

Chapter 29 · Data platforms on AWS

Chapter 30 · Multi-account and landing zones

Chapter 31 · Platform Engineering and Internal Developer Platform

Chapter 32 · Relevant AWS certifications

Chapter 33 · Projects to consolidate what you've learned

Chapter 34 · Resources and community

© Copyright 2024. All rights reserved