DEV Community

irfan pasha
irfan pasha

Posted on

Hosting a Static Website on Amazon S3 (Step-by-Step)

Hosting a static website using Amazon S3 is a simple and effective way to make static content publicly available without managing servers. In this article, I’m sharing the exact steps I followed to host my static website using Amazon S3.

Project Overview

This project demonstrates hosting a static website using Amazon S3 Static Website Hosting. The website contains static HTML and image files and is publicly accessible through an S3 website endpoint.

Steps I Followed
Step 1: Create an S3 Bucket

I logged in to the AWS Management Console, opened the Amazon S3 service, and created a new S3 bucket with a unique name in the us-east-1 region.

Step 2: Upload Website Files

After creating the bucket, I opened it and uploaded the static website files, including:

index.html

Image files

Step 3: Enable Static Website Hosting

From the Properties tab of the S3 bucket, I enabled Static website hosting, configured index.html as the index document, and saved the changes.

Step 4: Allow Public Access

I navigated to the Permissions tab and disabled Block all public access, acknowledging the warning to allow public access.

Step 5: Configure Bucket Policy

I added a bucket policy to allow public read access by granting the s3:GetObject permission so that users can view the website files.

Step 6: Verify Website Access

I copied the Static website endpoint from the bucket properties and opened it in a web browser to confirm the website loaded successfully.

Live Website URL
http://irfanpasha1234.s3-website-us-east-1.amazonaws.com

Conclusion

By following these steps, I successfully hosted a static website on Amazon S3. This approach is simple, cost-effective, and ideal for hosting static content such as portfolios and basic websites.

Top comments (0)