How to Upload Files to S3 and Host a Static Website
In this guide, you’ll learn how to upload files to an S3 bucket and configure it to host a static website (HTML/CSS/JS). This is ideal for portfolios, landing pages, or documentation.
✅ Part 1: Create an S3 Bucket
- Log in to your AWS Console
- Search for S3 and go to the S3 dashboard
- Click “Create bucket”
Configure:
- Bucket name:
my-static-site
(must be globally unique) - Region: Choose your preferred region
- Uncheck: “Block all public access” (we’ll allow public read access)
- Confirm you understand the public access settings
Click Create bucket
✅ Part 2: Upload Website Files
- Click the bucket you just created
- Click “Upload”
- Add your HTML, CSS, images, and JS files
- Example:
index.html
,style.css
,images/
- Example:
- Click Upload
✅ Part 3: Make the Files Public
- Go to the Permissions tab
- Scroll down to Bucket policy, click Edit
Paste this policy (replace my-static-site
with your bucket name):
jsonCopiarEditar{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "PublicReadGetObject",
"Effect": "Allow",
"Principal": "*",
"Action": "s3:GetObject",
"Resource": "arn:aws:s3:::my-static-site/*"
}
]
}
Click Save changes
✅ Part 4: Enable Static Website Hosting
- Go to the Properties tab
- Scroll to Static website hosting
- Click Edit
- Enable static website hosting
Configuration:
- Hosting type: Host a static website
- Index document:
index.html
- (Optional) Error document:
error.html
Click Save changes
✅ Part 5: Access Your Website
- Go back to Properties → Static website hosting
- Copy the Endpoint URL
- Paste it into your browser — your website is live!
Example:http://my-static-site.s3-website-us-east-1.amazonaws.com