AWS Builder Center

Host a Static Website on Amazon S3: A Student's Step-by-Step Guide

A student-friendly, step-by-step guide to hosting a static website on Amazon S3 — from creating the bucket to public access, testing, and cleanup.

Introduction

I am a B.Tech software engineering student learning AWS, and the first project that made cloud concepts click for me was hosting a simple static website on Amazon S3. No server to manage, no framework to install — just HTML, CSS, and a bucket.
In this article, I will walk through exactly how I did it, what went wrong the first time, and how to clean up so you do not get an unexpected bill. If you can create an S3 bucket and upload a file, you can follow this guide.

What you will build

A public static website with:
  • An  index.html  home page
  • An  error.html  page for missing pages
  • A public S3 website endpoint you can open in a browser
This is a good fit for a portfolio page, a college project demo, or a landing page. It is not a fit for a site that needs a database, user logins, or server-side code — for that, you would need something like Lambda, EC2, or Amplify.

Prerequisites

  • An AWS Builder ID / AWS account with access to S3
  • AWS CLI installed and configured, or use the S3 console
  • A small folder with  index.html  and  error.html 
  • A bucket name that is globally unique — S3 bucket names are shared across all AWS accounts

Step 1: Create your site files

Create a folder called  my-site  with two simple files.
 index.html :
<!DOCTYPE html>
<html>
<head>
<title>Hello from S3</title>
</head>
<body>
<h1>Hello from Amazon S3</h1>
<p>This static site is hosted on S3.</p>
</body>
</html>
 error.html :
<!DOCTYPE html>
<html>
<head>
<title>Page not found</title>
</head>
<body>
<h1>Oops — that page does not exist</h1>
<p><a href="index.html">Go back home</a></p>
</body>
</html>
Keep it simple at first. You can add CSS and images later once the basic flow works.

Step 2: Create the bucket

In the console, go to S3, choose Create bucket, and pick a unique name such as  my-static-site-awej-2026  and your nearest region.
With the AWS CLI, the same step is:
aws s3 mb s3://my-static-site-awej-2026 --region ap-south-1
Use your own unique name and region. Do not use the example name if it is already taken — S3 will tell you.

Step 3: Turn on static website hosting

A bucket is not a website until you enable that setting.
In the console: open the bucket, go to Properties, find Static website hosting, choose Enable, and set:
  • Index document:  index.html 
  • Error document:  error.html 
With the CLI:
aws s3 website s3://my-static-site-awej-2026 \
--index-document index.html \
--error-document error.html
S3 will then show a website endpoint, in a format like:  http://my-static-site-awej-2026.s3-website.ap-south-1.amazonaws.com 
That endpoint is HTTP, not HTTPS. If you need HTTPS and a custom domain later, put CloudFront in front of the bucket — that is a good next project, not a first step.

Step 4: Upload your files

aws s3 sync ./my-site s3://my-static-site-awej-2026
Or upload  index.html  and  error.html  in the console. After uploading, check that both objects are in the bucket root, not inside an extra folder — otherwise S3 will not find  index.html  at the site root.

Step 5: Allow public read access — carefully

This is the step where most beginners get stuck, and where you should be careful.
A new bucket blocks public access by default, which is a good default. For a public static site, you need to allow public read of the objects in this bucket only.
In the console, go to Permissions, turn off Block all public access for this bucket, then add a bucket policy that allows anyone to read objects:
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "PublicReadGetObject",
"Effect": "Allow",
"Principal": "*",
"Action": "s3:GetObject",
"Resource": "arn:aws:s3:::my-static-site-awej-2026/*"
}
]
}
Replace the bucket name with your own. This policy allows reading files, not deleting or uploading them. Do not use a public bucket for private files, and do not reuse this policy on a bucket that holds anything sensitive.

Step 6: Test it

Open the S3 website endpoint in a browser. You should see your  index.html  page.
If you see an error, check these in order:
  1. Is static website hosting enabled, with  index.html  as the index document?
  1. Are the files in the bucket root?
  1. Is Block Public Access off, and is the bucket policy saved?
  1. Did you open the website endpoint, not the regular S3 object URL? They are different, and the object URL will give an access error for a website-hosted bucket.
Try opening a page that does not exist, such as  /missing.html  — you should see your  error.html  page. That confirms the error document works.

What it costs, and how to clean up

For a small student site, S3 storage and requests are usually within the AWS Free Tier limits, but always check the billing dashboard in your own account — prices and free-tier limits can change.
When you are done experimenting, clean up so the bucket does not sit there forgotten:
aws s3 rm s3://my-static-site-awej-2026 --recursive
aws s3 rb s3://my-static-site-awej-2026
You must empty a bucket before you can delete it.

Takeaways

  • S3 can host a static website with no server to manage.
  • The three parts are: enable static website hosting, upload files to the bucket root, and allow public read with a narrow policy.
  • Use the website endpoint to test, not the object URL.
  • Keep public buckets for public files only, and delete test buckets when you are done.

What I will try next

My next step is to add CloudFront in front of this bucket for HTTPS, and then try a serverless contact form with Lambda. If you have done either of those as a student, I would love to hear what tripped you up in the comments.
Thank you for reading — and if this helped you get your first site live, let me know what you built.
Any opinions in this article are those of the individual author and may not reflect the opinions of AWS.
Enjoyed reading this content? Let the author know!

Your likes, comments, shares, and saves help creators reach more builders.

Loading recommendations

Loading article