DEMO: Setting Up Route 53 Hosted Zones and Routing Policies

Part A – Implementing a Route 53 Failover Routing Policy

Step 1: Create a Health Check for the Primary Resource

  1. Navigate to Route 53 → Health Checks → Create Health Check.
  2. Configure an endpoint health check for your primary EC2 application:
    • Endpoint can be specified by public IP or DNS name.
    • If using IP, assign an Elastic IP to ensure a static address even if the instance restarts or experiences issues.
  3. Health checks initially start in an unknown state and require some time to evaluate the endpoint before marking it healthy or unhealthy.

Step 2: Create Primary and Secondary Failover Records

Go to Route 53 → Hosted Zones → <YOUR_HOSTED_ZONE> → Create Record.

Configure primary failover record:

Configure secondary failover record:

Both records should now exist, with the primary record linked to its health check.

Step 3: Validate Failover

  1. Simulate failure by stopping the EC2 instance.
    • After a few minutes, traffic should automatically resolve to the secondary (S3) resource.
  2. Restart the EC2 instance to simulate recovery.
    • After propagation, traffic should resolve back to the primary EC2 resource.
Part B – Configuring a Private Hosted Zone

Create a private hosted zone:

Associate the hosted zone with the target VPC(s):

Define DNS records as needed (e.g., A records pointing to private IPs).

Test resolution by pinging the record’s IP from an EC2 instance inside an associated VPC.

R53 Multivalue Answer Routing Policy

Route 53 Multivalue Answer Routing – Architecture

R53 Weighted Routing Policy

Route 53 Weighted Routing – Architecture

R53 Latency Routing Policy

Route 53 Latency Routing – Architecture

Route 53 Geolocation-Based Routing

Route 53 Geolocation Routing – Architecture
Client locationRecord returned
Houston, Texas, USATexas
Sacramento, California, USAUnited States
Buenos Aires, ArgentinaArgentina
Porto Alegre, RS, BrazilSouth America
Toronto, Ontario, CanadaNo Answer
Munich, Bavaria, GermanyEurope
Tokyo, JapanNo Answer
Brisbane, Queensland, AustraliaNo Answer

Route 53 Geoproximity-Based Routing

Route 53 Geoproximity Routing – Architecture

Route 53 Routing Policies – Overview

Policies with 1–2 records per hostname (basic routing strategies)
Route 53 Routing PolicyDesignReturned RecordsTypical Use Cases
Simple– Single DNS record per hostname, may include multiple IP values
– No health monitoring configured
All record values are provided to the client in a non-deterministic order; the client selects which one to use– Direct traffic to a single application endpoint (e.g., web server)
– Straightforward and low-maintenance setup
Failover– Two DNS records sharing the same hostname: primary and standby
– Health check applied to the primary endpoint
– If the primary endpoint is healthy → return primary record
– If the primary endpoint fails → return secondary record
– Active-passive disaster recovery setup
– Useful for fallback scenarios like outages or maintenance pages
Policies with multiple records per hostname (advanced routing strategies)
Route 53 Routing PolicyDesignReturned RecordsTypical Use Cases
Multivalue AnswerMultiple DNS records share the same hostname, all treated with equal priorityReturns up to 8 healthy records, selected randomlySupports active-active DNS setups and enhances availability
WeightedEach DNS record is assigned a relative weightHealthy records are returned proportionally based on their assigned weight compared to the total– Gradual traffic shifting (e.g., canary releases)
– Basic traffic distribution across endpoints
LatencyRecords are associated with different AWS RegionsReturns the healthy endpoint with the lowest network latency for the requesterImproves response times and user experience for globally distributed applications
GeolocationRecords are mapped to specific geographic locationsReturns the most precise matching record based on user location (region → country → continent → default)– Deliver region-specific or localized content
– Enforce geographic restrictions
– Route users based on location
GeoproximityRecords are linked to geographic coordinates, with optional bias configurationReturns the closest healthy endpoint to the user, factoring in any configured biasEnables dynamic routing based on physical proximity and traffic shaping preferences

R53 Interoperability

Route 53 – Domain Registrar vs DNS Hosting Provider
Route 53 – Registrar and Hosting Combined
Route 53 – Registrar-Only Setup
Route 53 – Hosting-Only Setup

Implementing DNSSEC using R53

Enabling DNSSEC in an Amazon Route 53 Public Hosted Zone

This section covers the steps to enable DNSSEC for an existing Route 53 public hosted zone.

Step 1: Configure Keys and Signing within the Zone

  1. Key Signing Key (KSK)
    • KMS is used to generate an asymmetric key pair for the KSK.
    • KSK must be created in the us-east-1 region.
    • Route 53 uses the private KSK to sign the DNSKEY records, producing RRSIG records.
  2. Zone Signing Key (ZSK)
    • KMS is not used; Route 53 generates and manages ZSKs internally, including automatic rotation.
  3. DNSKEY Records
    • Public KSK and public ZSK are added to the zone’s DNSKEY records.
    • These records provide the cryptographic basis for DNSSEC validation.

Step 2: Establish Chain of Trust with the Parent Zone

  1. Provide Public KSK to Parent
    • If Route 53 is the registrar, it can automatically send the public KSK to the TLD registry.
    • If using a third-party registrar, the public KSK must be provided manually to the registrar, who updates the parent zone.
  2. Parent Zone DS Records
    • The parent zone stores a hash of the public KSK in its DS records.
    • This establishes trust from the parent zone to the child zone.

Step 3: Monitor DNSSEC Key Health

Step 4: Optional DNSSEC Validation for VPCs

Demonstration: Enabling DNSSEC for animals4life.org

Important: When enabling DNSSEC for a production zone, follow each step in order and allow each change to propagate before continuing. Pay attention to TTL values of domain records.

Step 1: Enable Zone Signing

  1. In the Route 53 public hosted zone, enable DNSSEC.
  2. Create a KSK for the zone, which generates a KMS key internally.
  3. Verify configuration: dig animals4life.org DNSKEY +dnssec
    • If DNSSEC is enabled, the response includes:
      • Public ZSK (flag=256)
      • Public KSK (flag=257)
      • RRSIG for the DNSKEY record
    • If not enabled, no DNSKEY record is returned.

Step 2: Establish Chain of Trust with Parent Zone

  1. Obtain the KSK information from the zone.
  2. In R53 Registered Domains, under DNSSEC, click “Manage Keys” and provide the public KSK.
  3. Verify chain of trust: dig org NS +short # List authoritative NSs for .org
    dig animals4life.org DS @
    • Presence of the DS record confirms the chain of trust.
    • Note: Propagation may take some time depending on TLD registry updates.

Step 3: Secure DNS Records with DNSSEC

Global Content Delivery and Network Optimization

Amazon CloudFront (CF) 101

Latency in Global Applications
Amazon CloudFront – Core Concepts

Key CloudFront Terminology

Key Features of CloudFront

CloudFront Architecture Overview
  1. Application content is stored in an origin (e.g., an S3 bucket).
  2. A CloudFront distribution is configured with the origin.
  3. Content is cached at multiple edge locations worldwide.
  4. Each distribution is assigned a unique domain name ending in cloudfront.net, with optional support for custom domains.
  5. Regional edge caches act as an additional caching layer between edge locations and the origin.

Request Flow

CloudFront Behaviors

Behavior Characteristics

Configuration Scope within Behaviors

CloudFront Distributions and Behaviors – Configuration Settings

CF Distribution-level Settings
CF Behavior-level Settings

CloudFront TTL and Cache Invalidations

CF Caching – Example Scenario
  1. A new image is uploaded to the origin.
  2. User A requests the image. Since it is not yet cached, an origin fetch occurs. The image is stored in the local cache with a defined Time-To-Live (TTL) and then returned to User A.
  3. The image is later updated at the origin, but the cached copy has not yet expired (still considered valid).
  4. User B requests the image. The cached version is served, even though it is now outdated.
    • This highlights a drawback of caching: cached content may become stale.
    • This situation should be minimized where possible, and CloudFront provides mechanisms to handle it.
  5. The cached image eventually expires, but it is not immediately removed—only marked as stale.
  6. User C requests the image. Since the cached version is expired, the request is forwarded to the origin:
    1. If the origin has a new version, it responds with 200 OK and returns the updated image. The cache is refreshed and the new version is delivered to User C.
    2. If the origin has no changes, it responds with 304 Not Modified. The cache marks the object as valid again and resets its TTL.
CF Time-To-Live (TTL) or Validity Period
CF Cache Invalidations

Versioned File Names

SSL/TLS Certificate Management (AWS Certificate Manager)

HTTPS Refresher
AWS Certificate Manager (ACM) – Overview

CloudFront and SSL/TLS Management

SSL in CloudFront
Server Name Indication (SNI)

SNI in CloudFront

SSL & SNI Architecture in CloudFront

CloudFront – Origin Types and Architecture

CloudFront Origins and Origin Groups

Types of Origins

  1. S3 Origins
    • Amazon S3 buckets
    • AWS MediaPackage endpoints
    • AWS MediaStore container endpoints
  2. Custom Origins
    • Any web server (on EC2, on-prem, or elsewhere)

Features and restrictions differ between S3 origins and custom origins.

Common features for all origins:

CloudFront – S3 Origins

Features:

CloudFront – Custom Origins

Features:

CloudFront – S3 Origins vs Custom Origins (Comparison Overview)
S3 OriginsCustom Origins
Amazon S3 buckets, MediaPackage channel endpoints, or MediaStore container endpointsBackend web servers (e.g., EC2, on-premises, or external services)
Minimal setup required, easy to configureOffers more advanced and flexible configuration options
Supports secure access using Origin Access Control (OAC) or legacy Origin Access Identity (OAI)Security typically implemented using custom headers or other mechanisms
Origin protocol policy is always aligned with the viewer protocolOrigin protocol policy can be explicitly set (HTTP only, HTTPS only, or match viewer protocol)
Uses standard HTTP/HTTPS ports by defaultSupports both standard and non-standard (custom) ports
No requirement to define a minimum SSL/TLS version for origin communicationRequires specifying the minimum SSL/TLS protocol version for origin connections

Securing CloudFront Origins

CloudFront Content Delivery Path
Securing S3 Origins

Origin Access Control (OAC) – Recommended

Origin Access Identity (OAI) – Legacy

Securing Custom Origins

LAB: Integrating a CDN with an S3 Static Website

Part 1: Create & Deploy a CloudFront Distribution with S3 Origin
  1. Deploy the provided CloudFormation stack

2. Create a CloudFront distribution

3. Default settings for demo purposes

4. Set the root default object

5. Deploy distribution

Part 2: Test the CloudFront Distribution
  1. Find your default CloudFront domain
    • Ends in cloudfront.net
  2. Open distribution in browser
    • Refresh a few times → pages load quickly (good performance)
    • Caching occurs both at the browser and CloudFront edge location
  3. Modify an object in S3
    • Example: overwrite merlin.jpg (can use a new image, but keep same name)
    • Verify via S3 static website endpoint that the latest version exists
  4. Check CloudFront caching behavior
    • Refresh CF distribution in browser → old image may still appear
    • Browser cache deletion does not bypass edge cache
    • 💡 Updated content is only visible after:
      • Cache TTL expires
      • Or you perform a CloudFront cache invalidation (incurs cost)
  5. Strategies for frequently updated content
    • Reduce object TTL in CloudFront
    • Use versioned object names (merlin_v1.jpgmerlin_v2.jpg)
      • Guarantees latest object served
      • Avoids cache invalidation costs
    • Perform cache invalidation sparingly (costly, generally for error fixes)

6. HTTPS support

Part 3: Add Alternate CNAME & SSL
  1. Requirement: custom domain hosted in Route53
    • Alternatively, follow the demo with placeholder domain
  2. Add alternate domain name (CNAME) in CloudFront distribution

3. Request SSL certificate in ACM

4. Select ACM certificate in CF distribution

5. Create Route53 record

6. Test custom domain

Part 4: Secure the S3 Origin with Origin Access Control (OAC)
  1. Problem: Public S3 bucket
    • By default, the S3 bucket is completely public, allowing all principals.
    • Direct access via S3 static website endpoint bypasses CloudFront, which is not secure.
  2. Configure Origin Access Control (OAC)
    • In CloudFront distribution, change Origin Access from Public → Origin access control settings
    • Create an OAC with default configuration → CF signs all requests to the S3 origin
    • Copy the generated policy; it will be used in the S3 bucket policy

3. Update S3 bucket policy

4. Test direct S3 access

5. Deploy distribution changes

6. Clean up

CloudFront – Private Distributions and Behaviors

CloudFront – Private Behaviors

Signed URL

Signed Cookie

Example Architecture: Serverless Mobile App with Mixed Behaviors

Request flow:

  1. App requests a resource from CloudFront (public behavior via API Gateway)
  2. When a sensitive image is requested, the Lambda signer validates access
  3. If access is authorized, Lambda generates a signed cookie (using Trusted Key Groups)
  4. Signed cookie and access information are returned to the app
  5. App requests the protected object, sending the signed cookie
  6. CloudFront validates the cookie, fetches the content from the S3 origin, and serves it to the app

CF – Lambda@Edge

CloudFront – Lambda@Edge
Lambda@Edge Architecture

AWS Global Accelerator

Performance Challenges in Single-Region Deployments
AWS Global Accelerator – Core Concepts
CloudFront vs Global Accelerator