← Blog

Serving static pages with S3 and CloudFront

Next.js can export your entire app as static HTML files using `output: 'export'` in next.config.ts. The result is a plain `/out` folder — no Node.js server required. Upload that folder to an S3 bucket with static website hosting enabled, put CloudFront in front of it, and you have a globally distributed site with HTTPS and edge caching. This is the cheapest way to run a website on AWS. You pay only for S3 storage (pennies) and CloudFront data transfer (fractions of a cent per GB after the free tier).