AWS · Networking and Content Delivery

Amazon CloudFront

A content delivery network that caches and serves content from edge locations near users, with TLS, WAF and edge functions built in.

On the SAA-C03 exam listContent delivery

What it is and what problem it solves

Amazon CloudFront is a content delivery network (CDN). A distribution sits in front of one or more origins (an S3 bucket, a load balancer, API Gateway, or any HTTP server) and serves requests from the nearest edge location. Cached responses are returned straight from the edge; misses go back to the origin, optionally through a regional cache.

Cache behaviors choose the origin and caching rules by path. Edge logic runs in CloudFront Functions (very small, fast header and URL changes) or Lambda@Edge (fuller functions). Origin access control lets a private S3 bucket accept requests only from CloudFront.

CloudFront: cache content at the edgeUserEdge locationcache hit: served hereOriginS3, ALB, any HTTP servermiss onlyHTTP(S) · caching · signed URLs · WAFGlobal Accelerator: a fast path inUser2 static anycast IPsnearest edgeRegion AALB / NLB / EC2Region BALB / NLB / EC2AWS backboneTCP + UDP · no caching · failover in seconds
CloudFront caches HTTP content near users; Global Accelerator routes any TCP or UDP traffic over the AWS network

When to use it

  • Static assets, images, video and downloads for users spread across regions.
  • Websites and APIs where you want TLS, HTTP/2 and HTTP/3, compression and DDoS protection at the edge.
  • Keeping an S3 bucket private while serving its content publicly.
  • Reducing load and data transfer from your origin by caching.

When to avoid it

  • Non-HTTP traffic (TCP or UDP games, VoIP): Global Accelerator handles those.
  • Content that is private to each user and never cacheable, where caching gains little (CloudFront can still help with TLS and edge security).
  • Very low-traffic internal tools where a CDN adds configuration for no benefit.

Scaling model and bottlenecks

CloudFront scales with demand across its edge network. What you size is the origin: a high cache hit ratio protects it. Origin Shield adds a central caching layer to reduce origin load further.

Performance, latency and throughput

Performance depends on the cache hit ratio: forward only the headers, cookies and query strings that change the response, set sensible cache times, and version file names so long caching is safe. Invalidations remove content early but are slower and costlier than versioned URLs.

Limits and quotas

ItemValueContextSource
Distributions per account 500
Can be raised with a quota request
Source
checked
Origins per distribution 100
Can be raised with a quota request
Source
checked
Cache behaviors per distribution 75
Can be raised with a quota request
Source
checked
Maximum cacheable file size per HTTP GET response 50 GB Source
checked
CloudFront Functions maximum function size 10 KB
Fixed limit
Source
checked
Lambda@Edge function timeout 30 seconds Source
checked

Quotas and limits change. Check the linked source before designing around a number.

Cost model

What you pay for

  • Pay as you go: data transfer out to the internet (per GB, varying by geography and price class), HTTP and HTTPS requests, data transfer to the origin, CloudFront Functions and Lambda@Edge invocations, invalidations above a free allowance, real-time logs and some optional features.
  • Flat-rate plans: a monthly price per distribution with request and data transfer allowances and no overage charges, bundling CDN, DNS, DDoS and WAF protection.
  • Data transfer from AWS origins to CloudFront is not charged; an always-free monthly allowance covers some data transfer and requests.

Where it is cost-efficient

Cacheable content with many repeat requests, and AWS origins, where origin fetches are free.

Where costs grow

Low cache hit ratios (many origin fetches), Lambda@Edge on every request, frequent wildcard invalidations, and serving very large volumes to expensive geographies.

Cost controls and common surprises

Raise the cache hit ratio, use a price class that excludes regions you do not need, version assets instead of invalidating, and prefer CloudFront Functions for simple edge logic.

Prices differ by Region and change over time; see the pricing page linked under Sources.

Security

Controls the service provides

  • TLS with free ACM certificates, and HTTPS-only or redirect policies.
  • Shield Standard DDoS protection at no extra charge, and AWS WAF integration.
  • Origin access control for private S3 origins; signed URLs and signed cookies for private content; geo restriction; field-level encryption.

What you configure

Require HTTPS, restrict the origin so it only accepts CloudFront traffic, attach a WAF web ACL to public sites, and use signed URLs for paid or private content.

Logging and monitoring

Standard access logs, real-time logs, CloudWatch metrics and CloudTrail.

Related security services

AWS WAF, Shield Advanced, ACM, S3 with origin access control.

Shared responsibility

AWS runs the edge network. You control caching, access to origins, TLS settings and what you publish.

Availability, backup and failure behavior

CloudFront serves cached content even when the origin is slow, and origin groups fail over to a secondary origin when the primary returns errors. Edge locations are spread worldwide, so a single location's failure is absorbed by others.

Common service combinations

S3 with origin access control for static sites; ALB or API Gateway origins; Route 53 alias records; ACM certificates (in US East (N. Virginia) for CloudFront); WAF and Shield Advanced; Lambda@Edge and CloudFront Functions.

Business application examples

  • A single-page application served from a private S3 bucket through CloudFront.
  • Paid video downloads protected with signed URLs.
  • A global API with WAF rules at the edge and an ALB origin.

Exam cues and common confusions

  • Cache static and dynamic content close to users, HTTP(S): CloudFront. TCP/UDP, static IPs, fast regional failover: Global Accelerator.
  • Keep S3 private behind CloudFront: origin access control (the older method was origin access identity).
  • Restrict paid content: signed URLs (one file) or signed cookies (many files).
  • Block countries: geo restriction. Block attacks: WAF on the distribution.
  • Certificate for CloudFront must be in US East (N. Virginia).

Related

Courses and lessons

Services, comparisons and patterns

Sources

Independent study material, not affiliated with or endorsed by Amazon Web Services. AWS and service names are trademarks of Amazon.com, Inc. or its affiliates.

Last reviewed · By the ByteCamel team · How we write content

Was this page helpful?

Report a mistake