Route 53, CloudFront & Global Accelerator
Pick routing policies and edge services for latency, failover and global users.
By Invicly Tech, , in AWS Solutions Architect – Associate. About 13 minutes to read.
In short
Route 53 is AWS's DNS service with routing policies and health checks for failover. CloudFront is a CDN that caches content at edge locations in front of S3, ALB or any origin. Global Accelerator gives two static anycast IPs that route TCP and UDP traffic over the AWS backbone to the healthiest endpoint.
Explained simply
When someone types a web address, their computer first asks DNS, the internet's phone book, for the matching IP address. Amazon Route 53 is AWS's DNS service. Besides plain answers, it can give different answers to different users: the nearest Region, a backup site when the main one is down, or 10 percent of users a new version.
Amazon CloudFront is a content delivery network (CDN). It keeps copies of your images, videos and pages in hundreds of edge locations around the world. A user in Tokyo gets files from a nearby edge instead of from your server in Virginia, so pages load faster and your servers do less work.
Some apps cannot use a CDN because nothing can be cached, or they use protocols other than HTTP, such as games or voice calls. AWS Global Accelerator helps here. It gives you two fixed IP addresses that work worldwide, and carries user traffic over AWS's private network to the healthiest Region.
Together these three services answer the global questions on the exam: how do users find my app, how do they get content quickly, and what happens when a Region fails?
Press Play on a diagram to walk through it one step at a time.
- 1User
Types app.example.com in a browser.
- 2Route 53
Alias record resolves to the CloudFront distribution.
- 3CloudFront edge
Serves cached content or forwards to origin.
- 4ALB
Routes the request to a healthy target.
- 5EC2 in Auto Scaling
Builds the dynamic response.
- Caches HTTP and HTTPS content
- Static and dynamic web delivery
- Integrates with WAF and OAC
- Edge functions for custom logic
- No caching
- Two static anycast IPs
- TCP and UDP, e.g. gaming, VoIP
- Fast regional failover
- Lowest measured network latency
- Best for performance
- Answers can shift over time
- One record per Region
- User's continent, country or state
- Best for language or legal rules
- Needs a default record
- Most specific location wins
- Physical distance to resources
- Bias grows or shrinks an area
- Good for shifting load gradually
- Uses AWS Regions or coordinates
In depth
How a DNS lookup reaches Route 53
A browser asks a recursive resolver, usually run by the ISP or a public DNS service. If the answer is not cached, the resolver asks the root servers, then the servers for the top-level domain such as .com, which point to the four Route 53 name servers listed for your hosted zone. Route 53 answers, and the resolver caches that answer for the record's TTL (time to live).
TTL drives failover speed. With a 300-second TTL, some users keep the old answer for up to five minutes after a change. Use 60 seconds or less for records that fail over. Alias records to AWS resources use the target's TTL.
Public hosted zones answer the internet. Private hosted zones answer only inside associated VPCs. For hybrid DNS, Route 53 Resolver inbound endpoints let on-premises servers query VPC names, and outbound endpoints with forwarding rules let VPCs query on-premises DNS.
- Browser to Recursive resolver: Where is app.example.com?1Where is app.example.com?
- Recursive resolver to Root and .com servers: Who serves example.com?2Who serves example.com?
- Root and .com servers to Recursive resolver: Route 53 name servers3Route 53 name servers
- Recursive resolver to Route 53: A record for app.example.com?4A record for app.example.com?
- Route 53 to Recursive resolver: Answer per routing policy, TTL 605Answer per routing policy, TTL 60
- Recursive resolver to Browser: IP address, cached for the TTL6IP address, cached for the TTL
Routing policies in practice
Simple returns one record set. Weighted splits traffic by ratio, for canary releases or A/B tests; weight 0 takes a record out. Latency-based answers with the Region that has the lowest measured latency for that user's network. Failover returns the primary while its health check passes, otherwise the secondary. Geolocation answers by the user's continent, country or US state, useful for language or legal rules; always add a default record for unmatched locations. Geoproximity routes by distance between user and resource, with a bias to grow or shrink a Region's area. Multivalue answer returns up to eight healthy records, giving simple client-side load spreading. IP-based routing answers by the user's source IP range, using CIDR collections you define.
Policies can be nested. For example, latency records can each point to a weighted set inside that Region.
- Split traffic
- Weighted
- Fastest or nearest
- Latency
- Geoproximity
- By user location or network
- Geolocation
- IP-based
- Stay available
- Failover
- Multivalue answer
- Just answer
- Simple
Health checks and failover
Endpoint health checks probe an IP or domain over HTTP, HTTPS or TCP, optionally looking for a string in the response. Checkers in several AWS Regions probe every 30 seconds, or every 10 seconds at extra cost, and an endpoint becomes unhealthy after three failures in a row by default. Route 53 treats it as healthy if more than 18 percent of checkers report healthy. Calculated health checks combine child checks, such as "healthy if two of three are up". CloudWatch alarm health checks follow an alarm, which is how you monitor private resources the checkers cannot reach.
For alias records, set Evaluate Target Health so Route 53 uses the load balancer's own health. Total failover time is roughly detection time plus the TTL, often one to two minutes. Make sure your firewall allows the Route 53 health checker IP ranges.
- Endpoint, calculated and CloudWatch alarm checks
- 30 s or 10 s interval, failure threshold 3 by default
- Private resources: use CloudWatch alarm checks
- Failover time is about detection plus TTL
CloudFront in front of S3 and ALB
A distribution has origins and cache behaviors. Behaviors match path patterns: send /api/* to the ALB with caching disabled, and everything else to an S3 bucket with long caching. A cache policy sets the cache key (which headers, cookies and query strings matter) and TTLs; by default the minimum TTL is 0, the default 24 hours, and the maximum one year. Include as little as possible in the cache key, or the hit rate drops.
Keep origins private. For S3, use origin access control (OAC) and a bucket policy that allows only your distribution. For an ALB, allow only the CloudFront origin-facing managed prefix list in its security group and check a secret custom header, or use VPC origins to reach a fully private ALB.
Use invalidations to remove stale files; the first 1,000 paths each month are free. Versioned file names avoid invalidations entirely. CloudFront Functions run tiny JavaScript at the edge for header and URL changes; Lambda@Edge runs heavier logic.
- 1Viewer
HTTPS to the nearest edge location.
- 2Edge cache
Hit: respond immediately.
- 3Regional edge cache
Bigger mid-tier cache on a miss.
- 4Origin Shield
Optional single layer before origin.
- 5Origin
S3 or ALB builds the response.
Global Accelerator in depth
Global Accelerator gives you two static anycast IPv4 addresses, announced from many edge locations at once. A user's packets enter the AWS network at the nearest edge and travel over the AWS backbone instead of the public internet, which reduces jitter and packet loss.
You configure listeners for TCP or UDP ports, and endpoint groups per Region. Each group has a traffic dial (the percentage of traffic it accepts) and endpoints with weights: ALBs, NLBs, EC2 instances or Elastic IPs. Health checks remove unhealthy endpoints, and because the IP addresses never change, failover does not wait for DNS caches to expire.
Client affinity can keep a user on the same endpoint. Client IP preservation is available for ALB and EC2 endpoints. Custom routing accelerators map users to specific EC2 instances and ports, used for multiplayer game sessions. Choose CloudFront for cacheable HTTP content, and Global Accelerator for static IPs, non-HTTP protocols or fast Regional failover.
- Two static anycast IPs, also usable with your own IPs
- TCP and UDP listeners
- Traffic dials per Region, weights per endpoint
- Failover without DNS TTL delays
Learn it in 4 short steps
About 1h each. Track them with a timer in your plan.
- 1Compare Route 53 routing policies~1h
- 2Configure health checks and failover~1h
- 3Put CloudFront in front of S3 and ALB~1h
- 4Explain when to use Global Accelerator~1h
Key points
- Routing policies: simple, weighted, latency, failover, geolocation, geoproximity, multivalue, IP-based.
- Alias records point to AWS resources, are free to query and work at the zone apex.
- Use origin access control so S3 content is only reachable through CloudFront.
- Choose Global Accelerator for static IPs or non-HTTP traffic needing fast failover.
Key terms
Tap a card to flip it. 0/6 known
Examples
Active-passive failover between Regions
The main site runs behind an ALB in us-east-1, and a standby stack runs in eu-west-1. Step 1: create a health check on the primary's /health page. Step 2: create a PRIMARY failover alias record for app.example.com pointing at the us-east-1 ALB, with the health check and Evaluate Target Health on. Step 3: create a SECONDARY failover alias record pointing at the eu-west-1 ALB. Step 4: test by making /health return 500; within about a minute and a half, Route 53 answers with the secondary. The alias target's HostedZoneId is the load balancer's canonical hosted zone ID, shown by describe-load-balancers.
aws route53 create-health-check --caller-reference app-primary-001 \
--health-check-config Type=HTTPS,FullyQualifiedDomainName=primary.example.com,ResourcePath=/health,RequestInterval=30,FailureThreshold=3
aws route53 change-resource-record-sets --hosted-zone-id $ZONE \
--change-batch '{"Changes":[{"Action":"UPSERT","ResourceRecordSet":{
"Name":"app.example.com","Type":"A",
"SetIdentifier":"primary","Failover":"PRIMARY",
"HealthCheckId":"'$HC_ID'",
"AliasTarget":{"HostedZoneId":"'$ALB_ZONE'",
"DNSName":"'$ALB_DNS'","EvaluateTargetHealth":true}}}]}'CloudFront with a private S3 bucket and an API
A single-page app keeps its files in S3 and its API behind an ALB. Step 1: create a distribution with two origins: the S3 bucket with an origin access control, and the ALB. Step 2: the default behavior points to S3 with the managed CachingOptimized policy. Step 3: a /api/* behavior points to the ALB with the managed CachingDisabled policy and all viewer headers forwarded. Step 4: keep Block Public Access on the bucket and add the bucket policy below, so only this distribution can read objects. Step 5: restrict the ALB security group to the CloudFront origin-facing prefix list.
{
"Version": "2012-10-17",
"Statement": [{
"Effect": "Allow",
"Principal": {"Service": "cloudfront.amazonaws.com"},
"Action": "s3:GetObject",
"Resource": "arn:aws:s3:::site-assets/*",
"Condition": {"StringEquals": {"AWS:SourceArn":
"arn:aws:cloudfront::111122223333:distribution/EDFDVBD6EXAMPLE"}}
}]
}Quick reference
- Use an alias record, not a CNAME, at the zone apex (example.com)
- Lower the TTL to 60 seconds or less on records that must fail over quickly
- Health checks: 30 s or 10 s interval; healthy if more than 18% of checkers agree
- Private resources: use CloudWatch alarm health checks
- Multivalue answer returns up to 8 healthy records
- CloudFront default TTL 24 h; first 1,000 invalidation paths per month are free
- Lock S3 origins with OAC; restrict ALB origins to the CloudFront prefix list
- Global Accelerator: 2 static anycast IPs, TCP and UDP, failover without DNS delays
Common mistakes
- Using a CNAME at the zone apex; use an alias record instead.
- Picking CloudFront for a UDP game server; it handles HTTP, not raw UDP.
Quick quiz
Pick an answer to see if you're right and why.
Practice exercises
Try each one yourself first. Use the hint if you get stuck, then compare with the solution.
- Exercise 1easy
Look up the name servers of a Route 53 hosted zone and check that the domain's registrar uses the same ones.
- Exercise 2medium
Send 90 percent of traffic to v1.example.com's ALB and 10 percent to v2 using weighted records.
- Exercise 3hard
Users far from us-east-1 complain about slow API calls that cannot be cached, and a partner firewall needs fixed IPs. Propose an edge design and explain why.
Check yourself
Answer in your head, reveal, then be honest with yourself.
Feel confident about this topic?
Frequently asked questions
- What is the difference between an alias record and a CNAME?
- A CNAME maps one name to another and cannot be used at the zone apex. An alias record points to AWS resources, works at the apex, and queries to AWS targets are free.
- Does CloudFront help with dynamic content?
- Yes. Even uncached requests benefit from TLS ending near the user and from the AWS backbone to the origin, and short TTLs can cache popular API responses briefly.
- Is Global Accelerator a replacement for CloudFront?
- No. CloudFront caches HTTP content at the edge. Global Accelerator does no caching; it gives static IPs and routes TCP or UDP traffic to the best Regional endpoint.
- Why does my DNS change take a while to show up?
- Resolvers keep cached answers until the old TTL expires. Lower the TTL well before planned changes.