CLF-C02 Beginner 15 min

S3 Static Website Hosting

Create an S3 bucket, upload a static website, configure permissions, and access it via a browser.

Amazon S3
Progress: 0 / 5 steps
Step 1
Create S3 Bucket

1. AWS Console → S3 → Create bucket
2. Bucket name: yourname-awslab-website (must be globally unique)
3. Region: closest to you
4. Block Public Access: Keep ON for now
5. Click Create bucket

Tip: S3 bucket names are globally unique across ALL AWS accounts worldwide!
Step 2
Upload HTML File

Create this file locally as index.html, then upload it to S3:

html
<!DOCTYPE html>
<html>
<head><title>My AWS Site</title></head>
<body>
  <h1>Hello from Amazon S3!</h1>
  <p>Static website hosted on AWS.</p>
  <p>No servers needed!</p>
</body>
</html>
Tip: Click "Upload" in your bucket → Add files → select index.html → Upload.
Step 3
Enable Static Website Hosting

1. Bucket → Properties tab
2. Scroll to "Static website hosting" → Edit
3. Enable → Index document: index.html
4. Save changes
5. Copy the Endpoint URL shown

Tip: The endpoint URL format is: http://BUCKET.s3-website-REGION.amazonaws.com
Step 4
Allow Public Access

1. Permissions tab → "Block public access" → Edit → Uncheck all → Save
2. Confirm
3. Bucket Policy → Edit → paste policy below (replace BUCKET_NAME):

json
{
  "Version": "2012-10-17",
  "Statement": [{
    "Effect": "Allow",
    "Principal": "*",
    "Action": "s3:GetObject",
    "Resource": "arn:aws:s3:::BUCKET_NAME/*"
  }]
}
Tip: This bucket policy grants read access to everyone. Only use for intentionally public content.
Step 5
Test and Clean Up

1. Open the Endpoint URL in your browser
2. You should see your HTML page!

Clean up:
1. Select all objects → Delete
2. Delete the bucket (Bucket → Delete)

Tip: Always clean up to avoid unexpected charges. S3 charges per GB stored.