Amazon S3 (Simple Storage Service) allows you to host static websites easily and cost-effectively. Whether it’s a personal portfolio, project landing page, or simple blog, here’s a step-by-step guide to help you set it up in minutes!
✅ To create a bucket
- Sign in to the AWS Management Console and open the Amazon S3 console: https://console.aws.amazon.com/s3/
- Click Create bucket.
- Enter your Bucket name (e.g.,
example.com
). - Choose your desired AWS Region.
- Click Create to proceed with the default settings.
🌐 To enable bucket versioning
- In the buckets list, click the bucket you just created.
- Go to the Properties tab.
- Scroll to Static website hosting and click Edit.
- Choose Use this bucket to host a website.
- Enable Static website hosting.
- In the Index document, enter
index.html
. - Click Save changes.
- You’ll now see a Website endpoint at the bottom of the section.
🔓 Edit Block Public Access settings
- In the buckets list, click your bucket name.
- Go to the Permissions tab.
- Under Block public access (bucket settings), click Edit.
- Uncheck Block all public access.
- Confirm and click Save changes.
🔐 Add a bucket policy that makes your bucket content publicly available
- Under your bucket, go to the Permissions tab.
- Scroll to Bucket policy and click Edit.
- Paste the following JSON policy (replace
Bucket-Name
with your actual bucket name):
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "PublicReadGetObject",
"Effect": "Allow",
"Principal": "*",
"Action": ["s3:GetObject"],
"Resource": ["arn:aws:s3:::Bucket-Name/*"]
}
]
}
- Click Save.
📁 Configure an index document
- Create an
index.html
file. Here's a simple example:
<!DOCTYPE html>
<html>
<head>
<title>My Website</title>
</head>
<body>
<h1>Welcome to my website!</h1>
<p>Now hosted on Amazon S3!</p>
</body>
</html>
- Go back to your bucket and make sure website hosting is enabled with
index.html
set as your index document. - Upload the file:
- Drag and drop it into the bucket, or
- Click Upload, choose the file, and complete the upload process.
🌍 Test your website endpoint
- In your bucket, go to the Properties tab.
- Scroll to Static website hosting.
- Click your Bucket website endpoint.
- Your website should now open in a new tab, live and hosted!
✅ Conclusion
That’s it! 🎉 You’ve successfully hosted your static website using Amazon S3.
This setup is not only free or low-cost (especially with the AWS Free Tier), but also super scalable and efficient for quick deployments. Whether you're showcasing your portfolio, sharing a project, or building a micro site — S3 makes it incredibly easy.
You can now customize your HTML file, add more pages, or even integrate it with a custom domain and SSL using Amazon Route 53 + CloudFront.
Happy hosting! 💻✨