Lab 01: S3 Static Website Hosting
Create an Amazon S3 bucket, enable static website hosting, upload your HTML files, and configure a public bucket policy. Your first live website on AWS — no servers required.
Services: Amazon S3 · IAM Cost: ~$0 Free Tier Time: 1–2 hours Level: Beginner
Overview
Amazon S3 (Simple Storage Service) can host entire static websites. When you enable static website hosting on a bucket, S3 serves your HTML, CSS, and JavaScript files directly to anyone who visits the endpoint URL — no EC2 instance, no web server, no OS to patch.
This is Lab 01 of the AWS Cloud Practitioner study series. In Lab 02 you will add a custom domain and HTTPS using Route 53 and CloudFront.
Architecture
- User opens the S3 website endpoint URL in their browser
- S3 finds the requested file in the bucket (defaults to
index.html) - The IAM bucket policy allows public read — anyone can access the files
- Your HTML page is returned and rendered in the browser over HTTP
AWS Services Used
| Service | Purpose | Free Tier |
|---|---|---|
| Amazon S3 | Stores and serves HTML, CSS, and image files as a static website | Yes |
| AWS IAM | Bucket policy grants public read access so visitors can load pages | Yes |
Prerequisites
- An active AWS account (free tier is sufficient)
- Access to the AWS Management Console at
console.aws.amazon.com - A basic
index.htmlfile ready to upload - A text editor (Notepad, VS Code, or any editor)
<h1>Hello, AWS Cloud!</h1> — saved as index.html. You can replace it with a polished page later.Sign into the AWS Console and select the correct region before creating any resources.
- Go to
console.aws.amazon.comand sign in - In the top-right corner click the region dropdown
- Select US East (N. Virginia) — us-east-1
- In the top search bar type
S3and click S3
us-east-1 is required for CloudFront compatibility in Lab 02.An S3 bucket is a container for your files. Bucket names must be globally unique across all of AWS.
- On the S3 console click Create bucket
- Under Bucket name enter a unique name e.g.
fredloomis-aws-lab-01 - Under AWS Region confirm
us-east-1is selected - Under Object Ownership leave the default: ACLs disabled
- Under Block Public Access settings — uncheck Block all public access
- Check the acknowledgment checkbox that appears
- Leave all other settings at defaults and click Create bucket
fl-aws-lab01-2026By default S3 serves objects as file downloads. Enabling Static Website Hosting switches S3 into a mode where it routes browser requests to your HTML files.
- Click on your bucket name to open it
- Click the Properties tab
- Scroll to the bottom — find Static website hosting and click Edit
- Select Enable
- Hosting type: Host a static website
- Index document:
index.html - Error document:
error.html - Click Save changes
- Scroll back down — copy and save the Bucket website endpoint URL that now appears
A bucket policy is a JSON document that defines who can access your bucket. For a public website you need to allow anyone to perform the s3:GetObject action.
- Click the Permissions tab on your bucket
- Scroll to Bucket policy and click Edit
- Delete any existing content and paste the following JSON — replacing
YOUR-BUCKET-NAMEwith your actual bucket name:
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "PublicReadGetObject",
"Effect": "Allow",
"Principal": "*",
"Action": "s3:GetObject",
"Resource": "arn:aws:s3:::YOUR-BUCKET-NAME/*"
}
]
}
- Click Save changes
- A red Publicly accessible badge will appear on your bucket — this confirms the policy is active
Resource line must end with /*. Without it, files will still return Access Denied errors even with the policy saved.- Click the Objects tab on your bucket
- Click Upload → Add files
- Select your
index.htmlfile (anderror.htmlif you have it) - Leave all other settings as default and click Upload
- Wait for the green success banner then click Close
Optional: Upload via AWS CLI
# Upload a single file aws s3 cp index.html s3://your-bucket-name/ # Upload all files in a folder aws s3 sync ./website/ s3://your-bucket-name/ --delete
- Go back to the Properties tab → scroll to Static website hosting
- Click the Bucket website endpoint URL
- Your
index.htmlpage should load in the browser - Test the error page: add
/fakepage.htmlto the URL — yourerror.htmlshould appear
Common issues
| Problem | Cause | Fix |
|---|---|---|
| 403 Access Denied | Bucket policy missing or incorrect | Re-check Step 4 — Resource must end with /* |
| 404 Not Found | index.html not uploaded or misspelled | Check the Objects tab — confirm index.html exists |
| NoSuchWebsiteConfiguration | Static website hosting not enabled | Re-check Step 3 — ensure hosting is set to Enable |
| CSS or images missing | Supporting files not uploaded | Upload all CSS, JS, and image files to the bucket |
Verification Checklist
- S3 bucket created with a globally unique name in us-east-1
- Block Public Access is disabled on the bucket
- Static website hosting enabled with index document set to index.html
- Bucket policy saved with Resource ARN ending in /*
- index.html uploaded and visible in the Objects tab
- Bucket website endpoint URL opens index.html in a browser
- A non-existent path returns the error.html page
What You Learned
- Amazon S3 fundamentals — buckets, objects, global naming, regions, and storage classes
- Static website hosting — how to configure S3 to serve HTML, index documents, and error documents
- IAM bucket policies — JSON policy structure and how
s3:GetObjectgrants public read access - Block Public Access — AWS multi-layer protection and the difference between disabling it vs. granting access via policy
- HTTP vs. HTTPS — S3 endpoints serve HTTP only; Lab 02 adds HTTPS via CloudFront and ACM
Lab Cleanup — Delete Your Resources
| # | Resource | How to Delete |
|---|---|---|
| 1 | S3 Bucket Objects | S3 → bucket → Objects tab → select all → Delete → type permanently delete |
| 2 | S3 Bucket | S3 → bucket list → select bucket → Delete → type bucket name → confirm |