Terraform on AWS: Nonprod and Production Environments · Edge: CloudFront, Route 53, ACM and WAF

CloudFront Static Site: S3 Origin with OAC and Cache Policies

Serve a React or static site from a private S3 bucket through CloudFront using an Origin Access Control so the bucket is never public, with a cache policy that handles SPA client-side routing.

Members can save this page, take notes and track progress. See membership · Sign in

What you'll build

A CloudFront distribution backed by a private S3 bucket using an Origin Access Control (OAC). The distribution has a default cache behaviour that serves index.html for 404s (SPA routing), a cache policy tuned for static assets, and a custom error response that maps 403 and 404 S3 responses to index.html with a 200 status.

Premium course

Keep reading with a membership

The rest of this lesson, its practice questions and the whole Terraform on AWS: Nonprod and Production Environments course are part of the membership.

See plans Sign in

Open in the app to mark lessons complete, take notes and track your progress.

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

Was this page helpful?

Report a mistake