AWS (S3 and CloudFront)

S3 behind CloudFront is the most common way to host a static site inside an organisation’s own cloud account, and it is where the conveniences of managed static hosts have to be rebuilt by hand: clean URLs and trailing slashes, redirects, atomic deploys, previews and rollbacks. The guides below rebuild each of them, and cover the CloudFront settings — cache policies, error caching, Origin Shield — that decide how often requests reach the bucket at all.

Request path through CloudFront and S3 Four layers. A CloudFront Function handles redirects and clean URLs at the viewer request. The CloudFront cache policy decides the cache key and TTLs. Origin Shield collapses misses into one regional request. The S3 bucket, private behind origin access control, holds the files. A static site on AWS, layer by layer CloudFront Function redirects, clean URLs viewer request Cache policy keys, TTLs, error caching hit ratio lives here Origin Shield regional tier fewer origin requests S3 bucket private, origin access control the files
Every layer has at least one guide below; most problems come from the top two.

Choosing the Right Static Site Generator for Production

Number of AWS (S3 and CloudFront) guides of each kind Vertical bars: How-tos 13, Fixes 0, Comparisons 2 and Concepts 0. AWS (S3 and CloudFront) guides by kind 13 How-tos 0 Fixes 2 Comparisons 0 Concepts
15 guides use AWS (S3 and CloudFront) in depth; each is listed below under the section it belongs to.

Core Web Vitals Optimization for SSGs

  • Cloudflare vs CloudFront Cache Hit Ratios for Static SitesComparisonCloudflare and CloudFront measured serving the same static site: cache hit ratio, origin requests, TTFB by region and cost, plus the settings that moved each.
  • Cache Keys and Query Strings on CDNsHow-toStop tracking parameters from fragmenting a static site’s CDN cache: normalize query strings in the cache key on Cloudflare and CloudFront, and measure hit ratio.
  • Cache-Control Headers on S3 and CloudFrontHow-toSet Cache-Control for a static site on S3 behind CloudFront: object metadata on upload, cache policies, response headers policies and invalidation, measured.
  • Caching 404s and Redirects at the EdgeHow-toCache 404 pages and redirects on a static site’s CDN so bots, broken links and migration redirects stop hitting the origin, without making fixes slow to appear.
  • Tiered Caching and Origin ShieldHow-toUse Cloudflare Tiered Cache or CloudFront Origin Shield so edge misses on a static site are served from a regional tier instead of the origin, with measured results.

Production-Ready Deployment & CI/CD for SSGs

  • Atomic Deploys vs Incremental UploadsComparisonWhy syncing files into a live bucket serves broken pages, how atomic publishing works, and how to build atomicity yourself on S3, object storage or a VM origin.
  • Blue-Green Deploys for Static SitesHow-toRun blue-green deploys for a self-hosted static site: two complete environments, verification before switching, an instant switch at the CDN and one-step rollback.
  • Clean URLs and Trailing Slashes on S3How-toMake directory-style URLs work on S3 behind CloudFront: a viewer-request function for index files, one canonical trailing-slash form, and tests that prove it.
  • CloudFront Functions for RedirectsHow-toServe hundreds of redirects for a static site on S3 from a CloudFront Function and KeyValueStore, generated from the build and tested on every deploy.
  • Deploying Only Changed FilesHow-toUpload only the files that changed in a static site deploy using content hashes, rsync or S3 sync with checksums, while keeping the deploy atomic and purges scoped.
  • Deploying a Static Site to S3 and CloudFrontHow-toDeploy a static site to a private S3 bucket behind CloudFront with Origin Access Control, split cache headers, ordered uploads and a targeted invalidation.
  • Rolling Back S3 and CloudFront Deploys With Versioned PrefixesHow-toMake S3 and CloudFront deploys atomic by uploading each build to its own prefix and switching CloudFront's origin path, so a rollback takes one config change.
  • Securing Deploy Credentials with GitHub OIDCHow-toReplace long-lived deploy tokens with short-lived OIDC credentials in GitHub Actions for AWS, Cloudflare and Netlify, scoped to one branch and one deploy job.
  • Sharing Build Cache Across CI RunnersHow-toShare a build cache across parallel CI runners with Turborepo remote cache, an S3-backed store, or scoped actions/cache. Architecture, signing, and measured savings.
Topics with the most AWS (S3 and CloudFront) guides Horizontal bars, largest first: CDN Caching Rules for SSGs 5, Rollbacks and Deploy Safety for Static Sites 3, Self-Hosting Static Sites on S3, Nginx and Caddy 3, Incremental Builds and Build Caching for SSGs 2, Next.js Static Export for Content Sites 1 and Security Headers and Hardening for Static Sites 1. Where AWS (S3 and CloudFront) comes up CDN Caching Rules 5 Rollbacks and Deploy Safety 3 Self-Hosting Static Sites on S3, Nginx… 3 Incremental Builds and Build Caching 2 Next.js Static Export for Content Sites 1 Security Headers and Hardening 1
Topic pages give the wider context for each group; the numbers count only guides that use this tool in depth.

Often used with AWS (S3 and CloudFront)

  • Cloudflare4 shared guidesPages and Workers hosting, cache rules and edge functions.
  • Next.js1 shared guidesStatic export for content sites, its limits and alternatives.
  • Netlify1 shared guidesHeaders, redirects, deploy previews and build caching.
  • GitHub Actions1 shared guidesCaching, matrix builds, reusable workflows and pinning.