Step-by-Step Guide: How to Create an S3 Bucket and Host a Static Website on AWS

Amazon S3 is a scalable, budget-friendly cloud storage service that can host static websites directly, eliminating the need for a traditional web server. In this guide, you’ll learn how to create an S3 bucket, configure it for web hosting, and deploy your HTML, CSS, and JavaScript files to a live public URL.

Prerequisites: an AWS account and a few static files (at minimum an index.html). The setup involves four key steps: create the bucket, enable static hosting, attach a bucket policy, and upload your content.

Article illustration

1. Create an S3 Bucket

Log in to the AWS Console and open the S3 service. Click Create Bucket, enter a globally unique name, and choose a region. Uncheck Block All Public Access so visitors can view your site, accept the warning, and click Create Bucket.

2. Enable Static Website Hosting

Open the bucket and go to Properties > Static Website Hosting > Edit. Select Enable, set the Index document to index.html, and optionally set an Error document. Save it. AWS then provides an endpoint URL (e.g., your-bucket.s3-website-us-east-1.amazonaws.com).

3. Add a Bucket Policy

Go to Permissions > Bucket Policy and paste the JSON below, replacing “your-bucket-name” with your actual bucket name. This grants public read access:

{“Version”:”2012-10-17″,”Statement”:[{“Effect”:”Allow”,”Principal”:”*”,”Action”:”s3:GetObject”,”Resource”:”arn:aws:s3:::your-bucket-name/*”}]}

4. Upload Files and Test

Open the Objects tab, click Upload, and add your files. Once uploaded, visit the endpoint URL to confirm your site is live. Keep in mind S3 only works with static content — any server-side features require additional AWS services.

Hosting a static site on S3 is a fast, secure, and incredibly affordable solution for portfolios, landing pages, and documentation. With just a few clicks, you’ve deployed a website that scales automatically and costs pennies per month. For custom domains, simply map your domain with Route 53 or any DNS provider.

sarah antaboga
Author: sarah antaboga

Leave a Reply

Your email address will not be published. Required fields are marked *