AWS Builder Center
Day 11: Amazon Route 53 and CloudFront – DNS and Content Delivery

Day 11: Amazon Route 53 and CloudFront – DNS and Content Delivery

Day 11 of my 90-day AWS challenge: how Route 53 turns domain names into IP addresses, how CloudFront delivers content faster from edge locations, and how the two work together with S3 for a fast, secure website.

Recap of Day 10

Yesterday I learned how load balancers and Auto Scaling keep an application available. Now the question is how users actually find it and how to make it fast for people far away. That is where Route 53 and CloudFront come in.

Amazon Route 53

Route 53 is AWS's highly available DNS (Domain Name System) service. DNS translates a name like example.com into an IP address that computers use. Route 53 can also register domains and check the health of your resources.

Common record types

RecordWhat it does
APoints a name to an IPv4 address
AAAAPoints a name to an IPv6 address
CNAMEPoints a name to another name
AliasAn AWS-specific record that points a name to AWS resources such as CloudFront, an ALB, or S3
MXDirects email to mail servers
TXTStores text, often used for verification

Routing policies

  • Simple: one record, one answer
  • Weighted: split traffic by percentage, e.g. 90/10 for testing a new version
  • Latency-based: send users to the Region with the lowest latency
  • Failover: switch to a backup when the primary fails a health check
  • Geolocation: route based on where the user is

Amazon CloudFront

CloudFront is a CDN (Content Delivery Network). It caches copies of your content at edge locations around the world, so users get it from a nearby location instead of from the origin server every time. This ties back to Day 1, when I learned about edge locations as part of the AWS Global Infrastructure.

Key concepts

ConceptWhat it is
DistributionThe CloudFront configuration that delivers your content
OriginWhere the original content lives, e.g. an S3 bucket or an ALB
Edge locationA nearby cache that serves users
TTLHow long content stays cached before CloudFront checks the origin again
InvalidationA request to remove cached content before the TTL ends
Origin Access Control (OAC)Lets CloudFront read a private S3 bucket so users cannot bypass it

How they work together

  1. A user types my domain name
  2. Route 53 resolves it, using an Alias record, to a CloudFront distribution
  3. CloudFront serves the content from the nearest edge location, or fetches it from the S3 origin if it is not cached
  4. The S3 bucket stays private, and only CloudFront can read it
  5. HTTPS is provided with a certificate from AWS Certificate Manager (ACM)

What I practiced today

  1. Explored hosted zones and record types in the Route 53 console
  2. Created a CloudFront distribution with an S3 bucket as the origin
  3. Used Origin Access Control so the bucket stays private
  4. Opened the distribution's domain name and checked that my page loaded
  5. Cleaned up the resources afterwards

Key takeaways

  • Route 53 answers where a name points, and CloudFront decides how fast content arrives
  • Keep S3 buckets private and serve them through CloudFront
  • A Route 53 hosted zone and a registered domain both have costs, so check pricing first

Up next: Day 12

Amazon DynamoDB: NoSQL databases on AWS.
Learning AWS too? Follow along and share what you're building. #90DaysOfAWS
Any opinions in this article are those of the individual author and may not reflect the opinions of AWS.
Enjoyed reading this content? Let the author know!

Your likes, comments, shares, and saves help creators reach more builders.

Loading recommendations

Loading article