Study Guide1,342 words

AWS Edge Integration Patterns: CloudFront, Global Accelerator, and Load Balancing

Integration patterns for content distribution networks and global traffic management with other services (for example, Elastic Load Balancing [ELB], Amazon API Gateway)

AWS Edge Integration Patterns: CloudFront, Global Accelerator, and Load Balancing

This guide explores the architectural patterns used to integrate AWS edge services—Amazon CloudFront and AWS Global Accelerator—with core compute and networking services like Elastic Load Balancing (ELB) and Amazon API Gateway. Mastering these patterns is essential for designing high-performance, global-scale applications.

Learning Objectives

After studying this guide, you should be able to:

  • Evaluate global traffic requirements to select between Amazon CloudFront and AWS Global Accelerator.
  • Design integration patterns that combine CloudFront with Application Load Balancers (ALB) and Amazon API Gateway.
  • Configure Global Accelerator to front Multi-Region ELB deployments.
  • Optimize application performance by leveraging SSL/TLS termination at the AWS edge.
  • Understand the role of Route 53 in global traffic management and DNS-based failover.

Key Terms & Glossary

  • Edge Location: A site that CloudFront uses to cache copies of your content and where AWS Global Accelerator points of presence (PoPs) are located.
  • Origin: The source of truth for content, such as an S3 bucket, an ELB, or an API Gateway endpoint.
  • Anycast IP: A networking technique where multiple routing destinations are assigned the same IP address. AWS Global Accelerator uses this to route users to the nearest healthy endpoint.
  • Regional Edge Cache: An intermediate cache layer between CloudFront edge locations and your origin to further reduce origin load.
  • TTL (Time to Live): The duration for which a record or cached object remains valid before it must be refreshed from the origin.
  • TLS Offloading: The process of terminating an encrypted connection at an intermediate point (like CloudFront or ALB) to reduce the processing burden on backend servers.

The "Big Idea"

In modern cloud architecture, the goal is to minimize the "distance" between the user and the application's processing logic. By shifting content delivery (caching) and connection termination (SSL/TLS) to the AWS Global Network edge, we bypass the unpredictable public internet for as much of the journey as possible. This results in lower latency, higher security, and better protection against DDoS attacks.

Formula / Concept Box

FeatureAmazon CloudFrontAWS Global Accelerator
Primary Use CaseContent Delivery Network (CDN) / CachingGlobal Network Optimization / Fixed IPs
LayerLayer 7 (HTTP/HTTPS only)Layer 4 (TCP/UDP)
MechanismCaches static/dynamic content at edgeRoutes traffic via Anycast IPs over AWS backbone
Integration PointsS3, ELB, API Gateway, Custom OriginsALB, NLB, EC2, Elastic IPs
Static ContentHigh optimization via cachingNo caching; optimized routing only

Hierarchical Outline

  1. Amazon CloudFront Integration Patterns
    • CloudFront + ALB: Offloading SSL/TLS to the edge; caching static assets while forwarding dynamic requests.
    • CloudFront + API Gateway: Edge-optimized vs. Regional endpoints; using CloudFront for compression and global distribution.
    • Custom Origin Access: Using Origin Access Control (OAC) for S3 or custom headers to ensure traffic only reaches the origin via CloudFront.
  2. AWS Global Accelerator Patterns
    • Multi-Region ALB Fronting: Using Anycast IPs to route traffic to the closest healthy Regional ALB.
    • NLB Integration: Providing static IP addresses for non-HTTP applications (e.g., gaming, IoT).
    • Failover Logic: Automated health checks and traffic shifting across Regions.
  3. Global Traffic Management (Route 53)
    • Traffic Policies: Geolocation, Geoproximity, and Latency-based routing.
    • Health Checks: Integrated failover with CloudFront and ELB.

Visual Anchors

CloudFront to ALB Request Flow

Loading Diagram...

Global Accelerator Multi-Region Routing

\begin{tikzpicture}[node distance=2cm, every node/.style={draw, rectangle, align=center, rounded corners}] % Nodes \node (User) [fill=blue!10] {Global User}; \node (GA) [right=of User, fill=orange!20] {Global Accelerator$Anycast IPs)}; \node (R1) [above right=of GA, fill=green!10] {Region A\ALB / Targets}; \node (R2) [below right=of GA, fill=green!10] {Region B\ALB / Targets};

code
% Paths \draw[->, thick] (User) -- (GA); \draw[->, dashed] (GA) -- node[above, sloped, draw=none] {Lowest Latency} (R1); \draw[->, dashed] (GA) -- node[below, sloped, draw=none] {Backup} (R2);

\end{tikzpicture}

Definition-Example Pairs

  • Origin Shield: An additional caching layer in CloudFront that protects the origin from "cache stampedes" (too many simultaneous requests for the same content).
    • Example: A major news site experiencing a sudden traffic spike; Origin Shield consolidates multiple requests for a breaking story into a single request to the backend server.
  • Anycast IP Propagation: The process of announcing the same IP address from multiple AWS edge locations via BGP (Border Gateway Protocol).
    • Example: A gaming application uses two Global Accelerator static IPs. A player in Tokyo and a player in London use the exact same IPs, but the Tokyo player is routed to ap-northeast-1 and the London player to eu-west-2 automatically.

Worked Examples

Problem: Low Latency API for a Global Mobile App

Scenario: A company has a REST API hosted on an Application Load Balancer in us-east-1. Users in Europe and Asia are reporting high latency.

Step-by-Step Solution:

  1. Analyze Traffic: Since the API uses HTTP/S, CloudFront is the primary candidate for caching and TLS termination.
  2. Configure CloudFront:
    • Create a CloudFront distribution.
    • Set the Origin to the DNS name of the Regional ALB.
    • Configure Cache Behaviors:
      • For /static/*: Long TTL (e.g., 24 hours).
      • For /api/*: Set TTL to 0 (Forward only) but enable Forward Headers (e.g., Authorization) to ensure the ALB can process requests.
  3. Optimize TLS: Upload the SSL certificate to AWS Certificate Manager (ACM) in us-east-1 (required for CloudFront). CloudFront now terminates the user's TLS connection at the edge, reducing the 3-way handshake distance.
  4. Security: Attach an AWS WAF web ACL to the CloudFront distribution to filter malicious traffic before it reaches the ALB.

Checkpoint Questions

  1. What is the primary difference in how CloudFront and Global Accelerator handle traffic?
    (Answer: CloudFront caches content at the edge (Layer 7), while Global Accelerator optimizes the network path via the AWS backbone using Anycast (Layer 4).)
  2. Where must an ACM certificate be located to be used with Amazon CloudFront?
    (Answer: In the us-east-1 (N. Virginia) Region.)
  3. True or False: Global Accelerator can be used to front an Amazon S3 bucket directly.
    (Answer: False. Global Accelerator fronts ALBs, NLBs, EC2 instances, and Elastic IPs. Use CloudFront for S3.)
  4. Which service would you use to provide a fixed set of IP addresses for a whitelisted firewall?
    (Answer: AWS Global Accelerator.)

Muddy Points & Cross-Refs

  • TLS Termination Locations: Students often get confused about where to terminate TLS.
    • Edge Termination: Best for latency (CloudFront/Global Accelerator).
    • ALB Termination: Best for complex routing logic within a VPC.
    • End-to-End Encryption: Required for some compliance; requires certificates at both the Edge and the Target.
  • CloudFront vs. API Gateway Edge-Optimized: An "Edge-Optimized" API Gateway endpoint actually is a regional API Gateway with a hidden, AWS-managed CloudFront distribution in front of it. If you need fine-grained control over caching or WAF, create a Regional API Gateway and manually put your own CloudFront distribution in front of it.

Comparison Tables

Application Load Balancer vs. Network Load Balancer

FeatureALBNLB
OSI LayerLayer 7 (Application)Layer 4 (Transport)
Best ForHTTP/HTTPS / Path-based routingTCP/UDP / Ultra-low latency / Static IPs
CloudFront IntegrationSeamless as OriginSupported (via DNS name)
Global Accel. IntegrationSupportedSupported
TLS TerminationYesYes (TLS Listener)

[!IMPORTANT] When integrating CloudFront with an ALB, ensure the ALB's Security Group allows traffic only from CloudFront's IP ranges. This can be automated using the AWS-managed prefix list for CloudFront to prevent users from bypassing the CDN and hitting your origin directly.

Ready to study AWS Certified Advanced Networking - Specialty (ANS-C01)?

Practice tests, flashcards, and all study notes — free, no sign-up needed.

Start Studying — Free