Brochures, documentation sites, landing pages, and portfolio sites often do not need a traditional server at all. When you host static website on s3, Amazon S3 stores your HTML, CSS, JavaScript, and images and serves them directly, with high durability and very low cost. In this guide you will host static website on s3 step by step: create a bucket, enable website hosting, apply a public read policy, upload your files, turn on versioning, and add lifecycle rules that control storage costs automatically.
This approach pairs well with the servers covered in our guide on how to launch your first EC2 instance on AWS: use EC2 for dynamic applications, and use S3 when the content is static. The result is simpler operations, no operating system to patch, and a site that scales without you resizing anything. Browse our AWS category for more tutorials in this series.
Prerequisites to Host Static Website on S3
- An AWS account with permission to create S3 buckets and edit bucket policies.
- A static website ready to upload: at minimum an
index.htmlfile and an error page such aserror.html. - The AWS CLI installed and configured if you want to follow the command-line steps, although every step can also be done in the console.
- A globally unique bucket name, because S3 bucket names are unique across all of AWS.
- Optional: a custom domain name if you plan to serve the site from your own hostname later.
The official Amazon S3 User Guide covers every service concept in depth and is worth bookmarking alongside this tutorial.
Step 1: Create the S3 Bucket
Sign in to the AWS console, open Amazon S3, and choose Create bucket. Pick a descriptive, globally unique name and select the AWS Region closest to most of your visitors. Leave the other defaults in place for now, because you will adjust public access deliberately in a later step.
With the AWS CLI, the same step looks like this:
aws s3api create-bucket --bucket my-example-website-2026 --region us-east-1
For Regions outside us-east-1, the CLI also needs a location constraint in the create-bucket configuration. After creation, open the bucket and review its Properties tab, where the website hosting, versioning, and lifecycle settings used in this tutorial all live.
Step 2: Enable Static Website Hosting
In the bucket Properties tab, find Static website hosting and choose Edit. Select Enable, set the hosting type to host a static website, and enter your index document and error document names:
Index document: index.html
Error document: error.html
Save the changes and note the bucket website endpoint shown on the same page. That endpoint is the public address of your site until you optionally add CloudFront or a custom domain. The CLI equivalent is:
aws s3 website s3://my-example-website-2026/ --index-document index.html --error-document error.html

Step 3: Allow Public Read with a Bucket Policy
By default S3 blocks public access, which is the right default for private data. A public website is the deliberate exception. In the Permissions tab, edit Block public access and clear only the settings needed for a public website policy, then add a policy that allows anyone to read objects, but not to write or delete them:
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "PublicReadGetObject",
"Effect": "Allow",
"Principal": "*",
"Action": "s3:GetObject",
"Resource": "arn:aws:s3:::my-example-website-2026/*"
}
]
}
Replace the example bucket name with your own. This least-privilege public policy is a key reason the host static website on s3 pattern is safe for public content: visitors can download pages and images, while only your AWS account can change or remove them. Never use a policy that grants write actions to everyone.
Step 4: Upload Your Website Files
Upload your files in the console with the Upload button, or sync a local folder with the CLI, which is faster and repeatable for updates:
aws s3 sync ./my-website/ s3://my-example-website-2026/ --delete
aws s3 ls s3://my-example-website-2026/
Open the bucket website endpoint in a browser and click through every page. Check that images load, links work, and an unknown address shows your error page. Fix missing files now, before you add versioning and lifecycle automation on top.
Step 5: Host Static Website on S3 with Versioning Enabled
Versioning keeps a copy of an object every time it changes, so an accidental overwrite or delete can be undone. In the bucket Properties tab, edit Bucket Versioning and choose Enable, then save. With the CLI:
aws s3api put-bucket-versioning --bucket my-example-website-2026 --versioning-configuration Status=Enabled
aws s3api get-bucket-versioning --bucket my-example-website-2026
Test it by uploading a small change to index.html, then opening the object in the console and checking its Versions tab. You should see both the current and previous versions. Versioning is simple insurance, and for a frequently updated documentation or marketing site it quickly proves its value the first time someone publishes the wrong file.
Step 6: Add Lifecycle Rules for Old Versions and Incomplete Uploads
Versioning without lifecycle rules grows storage forever. Open the Management tab and create a lifecycle rule with two jobs. First, transition noncurrent versions to cheaper cold storage and eventually expire them:
Rule name: archive-old-versions
Noncurrent versions: transition to Glacier Flexible Retrieval after 30 days
Noncurrent versions: expire after 90 days
Second, delete incomplete multipart uploads, which are abandoned fragments from interrupted transfers that still consume storage:
Rule name: clean-incomplete-uploads
Delete incomplete multipart uploads after 7 days
The CLI can describe the configuration you created:
aws s3api get-bucket-lifecycle-configuration --bucket my-example-website-2026
Together these rules are what make it practical to host static website on s3 for years: current pages stay fast and available, older versions move to low-cost Glacier storage, abandoned upload fragments disappear, and your monthly bill stays predictable instead of creeping upward silently.
Optional: Add CloudFront in Front of the Bucket
S3 website endpoints serve content from a single Region and only over HTTP. A CloudFront distribution adds global edge caching, HTTPS with a free AWS Certificate Manager certificate, and support for a custom domain. Create a distribution that uses your bucket as the origin, attach your certificate, and point your domain at the distribution. This is optional for a first site, but recommended before you promote the address publicly.
Troubleshooting Common S3 Website Problems
403 Forbidden on the website endpoint: Check that Block public access is relaxed for the bucket, the bucket policy uses the correct bucket name in the resource ARN, and website hosting is enabled. Policy changes can take a short time to propagate.
404 or NoSuchKey errors: Confirm the index document name matches the actual file name exactly, including capitalization, and that the file was uploaded to the root of the bucket rather than a subfolder.
New version not visible: Your browser may be caching the old page. Hard-refresh, test in a private window, and if you added CloudFront, create a cache invalidation for the updated paths.
Lifecycle rule seems inactive: Lifecycle actions run asynchronously, usually within a day or so, and they apply based on object age. Check the rule status is Enabled and that its filters cover the objects you expect.
Conclusion
You now know how to host static website on s3 from start to finish: create the bucket, enable website hosting, publish safely with a read-only public policy, upload your files, protect changes with versioning, and control long-term costs with lifecycle rules. Add CloudFront when you need HTTPS and a custom domain, and review your bucket settings whenever your site changes purpose. For static content, this is one of the simplest, cheapest, and most reliable hosting patterns on AWS.