AWS in 1 Min · Episode 98

S3 static website hosting explained

A website with no server. Watch the one-minute video, then read the details.

David Gomez1:15 video · 2 min read

"Every website needs a web server." Not if the site is just files. Landing pages, documentation, portfolios and single-page apps built with React or Vue compile down to HTML, CSS, JavaScript and images. Amazon S3 can serve those files directly, with no server to patch, scale or keep running at 3 a.m.

What "static" means

A static site sends the same files to every visitor. Any logic runs in the visitor's browser. That's still enough for a lot: a modern single-page app is static files that call APIs for everything dynamic. What S3 won't do is run code on the server side, such as PHP, Node.js or Python.

Turning it on

  1. Create a bucket and upload your built site.
  2. Enable static website hosting in the bucket's properties.
  3. Set an index document (usually index.html) and an optional error document (error.html).
  4. S3 gives you a website endpoint like http://bucket-name.s3-website-region.amazonaws.com (some Regions use a dot instead of a dash).

The website endpoint behaves like a web server: it returns the index document for folder paths, HTML error pages instead of XML, and supports redirects. It only answers GET and HEAD.

The catch: HTTP only, and public files

AWS's documentation is direct: S3 website endpoints do not support HTTPS. They also serve only publicly readable content, so you must turn off Block Public Access for that bucket and add a public-read bucket policy. Browsers flag HTTP sites as "not secure", and a public bucket is easy to misconfigure. For anything beyond a quick test, that's not acceptable.

The production pattern: CloudFront or Amplify

Put Amazon CloudFront in front of the bucket:

  • HTTPS with a free certificate from AWS Certificate Manager, on your own domain.
  • Caching at edge locations worldwide, so pages load fast far from your Region.
  • The bucket can stay private: CloudFront reads it through origin access control (OAC), and Block Public Access stays on. If the bucket uses SSE-KMS encryption, OAC is required.

A common mistake: with a private bucket behind OAC you use the REST endpoint, not the website endpoint, so index documents work only at the root. Single-page apps usually fix this by setting the default root object and mapping 403/404 errors to /index.html.

AWS now also recommends AWS Amplify Hosting for static sites stored in S3: it deploys your bucket's content to a managed CloudFront CDN and gives you an HTTPS URL without wiring the pieces yourself.

Where AI fits

The front end of many AI apps (a chat window, an upload form, a dashboard) is a static single-page app, so it fits this pattern well. The browser then calls your own API, for example API Gateway and Lambda, which calls Amazon Bedrock with an IAM role. Never put a model API key in the front end: every file you serve can be read by anyone who opens the page.

Quick recap

  • S3 can host static files (HTML, CSS, JavaScript, images); no server-side code runs.
  • The website endpoint is HTTP only and needs public objects.
  • In production, use CloudFront with OAC (private bucket, HTTPS, your domain) or Amplify Hosting.
  • AI front ends call a backend API; secrets never go in the page.
AWS in 1 Min #98 · 1:15

Need an AWS expert on your team?

I'm David, an AWS expert and fractional cloud consultant. I work alongside your team to run your cloud and infrastructure: architecture, security, cost and day-to-day operations. You get senior AWS experience when you need it, without the cost of a full-time hire.

  • Architecture reviews and a clear plan for what to fix first
  • Security hardening: IAM, networking, audits
  • Lower AWS bills without slowing your team down
  • Hands-on help with AI workloads on AWS