ladderlore
  • Type a service name, like S3 or IAM.

Service · Networking and Content Delivery · Builds on CLF-C02

Amazon CloudFront

A CDN with cache rules, private S3 origins, origin failover, signed access and code at the edge.

You know from Cloud Practitioner

  • CloudFront caches content in edge locations near users.
  • The origin can be S3, a load balancer, EC2 or a server outside AWS.
  • It works with AWS Shield, AWS WAF and ACM.
Read the Cloud Practitioner lesson
Users
CloudFront
S3
Second origin
requestprimaryon errors
An origin group tries the second origin when the first one fails.
  • Keep S3 private

    Origin access control
  • One private file

    Signed URL
  • Many private files

    Signed cookies
  • Block countries

    Geographic restriction
  • Protect form fields

    Field-level encryption
  • Tiny edge logic

    CloudFront Functions
  • Heavy edge logic

    Lambda@Edge
CloudFront features and the need each one meets.

1 / 2

  • Keep S3 private

    Origin access control
  • One private file

    Signed URL
  • Many private files

    Signed cookies
  • Block countries

    Geographic restriction

2 / 2

  • Protect form fields

    Field-level encryption
  • Tiny edge logic

    CloudFront Functions
  • Heavy edge logic

    Lambda@Edge
CloudFront features and the need each one meets.

What it is

A cache behavior maps a path pattern, such as /images/*, to an origin and to cache rules, including how long content stays cached (TTL). To change content early you can invalidate paths, but each invalidation takes time and can cost money. Putting a version in the file name is the better habit. For S3 origins, use origin access control (OAC), so the bucket stays private and only CloudFront can read it.

What it is

An origin group gives failover: if the primary origin returns an error, CloudFront tries the secondary origin. To restrict content, use signed URLs for single files or signed cookies for many files, geographic restrictions to allow or block countries, and field-level encryption to protect sensitive form fields at the edge. To run code, CloudFront Functions suit short JavaScript tasks such as redirects and header changes. Lambda@Edge suits longer tasks that need network access.

Remember

  • Cache behavior: path pattern, origin, TTL and cache rules.
  • OAC keeps an S3 bucket private. Origin groups fail over to a second origin.
  • Signed URLs: one file. Signed cookies: many files.
  • Geographic restrictions allow or block countries. Field-level encryption protects chosen form fields.

Remember

  • CloudFront Functions: JavaScript, under a millisecond, viewer events only, no network access.
  • Lambda@Edge: Node.js or Python, can use the network, runs on all four events.

On the exam

  • “Serve private S3 content only through CloudFront” points to origin access control.
  • “Paid content for subscribers, many files” points to signed cookies. One file points to a signed URL.
  • “Simple header rewrite at massive scale, lowest cost” points to CloudFront Functions.
  • “Fail over when the origin is down” points to an origin group.