Thuta Learning
IntermediateDevOpsbeginner

Static Website Hosting with S3

Relax. We'll talk through this in plain words — no textbook voice.

What you'll walk away with

  • Understand Static Website Hosting with S3 without the intimidation
  • Be able to run the AWS CLI/Console yourself
  • Apply this concept immediately in a real project

Let's think about this for a second

A static website (a React/Vue build output, or a plain HTML page) doesn't need any server-side processing — turn on the 'Static Website Hosting' feature on an S3 bucket, upload your HTML/CSS/JS files, and your website is live (no EC2 server required at all). You'll need to configure an Index Document (usually index.html) and an Error Document (404.html), and open the bucket policy for public read access (since a website needs to be publicly accessible).

Let's connect this to a real scenario

Enable S3 static website hosting and upload `index.html`, `style.css`, and `script.js`, and S3 gives you a website URL (something like `http://my-bucket.s3-website-us-east-1.amazonaws.com`) — you can also point Route 53 (Advanced chapter) at it to use your own custom domain name. Putting CloudFront (a CDN) in front of it delivers content from the Edge Location closest to each user, making load times faster.

Let's look at it together

bash
# Enable static website hosting
aws s3 website s3://my-tutorial-bucket-2026 \
  --index-document index.html --error-document 404.html

# Upload your site files
aws s3 sync ./dist s3://my-tutorial-bucket-2026

# Your site is now live at:
# http://my-tutorial-bucket-2026.s3-website-<region>.amazonaws.com
You should see
$ curl -I http://my-tutorial-bucket-2026.s3-website-us-east-1.amazonaws.com
HTTP/1.1 200 OK
Content-Type: text/html

5-minute try-it

Write a simple `index.html` file, upload it to an S3 bucket, and enable static website hosting — then open the URL S3 gives you in a browser.

A quick word of caution

Opening a bucket policy for public access is meant only for static assets (HTML/CSS/JS) — never put sensitive or private data in that same bucket.

Easy traps

  • Enabling Static Website Hosting but forgetting to open up public read access in the bucket policy — you'll get a 403 Forbidden when you visit the website URL
  • Uploading index.html into a subfolder instead of the bucket root — this won't match the path expected by the Index Document setting

Now try it yourself

Write a simple `index.html` file, upload it to an S3 bucket, and enable static website hosting — then open the URL S3 gives you in a browser.

You'll know it worked when: $ curl -I http://my-tutorial-bucket-2026.s3-website-us-east-1.amazonaws.com HTTP/1.1 200 OK Content-Type: text/html

Static Website Hosting with S3 | Thuta Learning