DEV Community

Deepak Sharma
Deepak Sharma

Posted on

How to Host a Static Website on AWS S3 (Step-by-Step Guide)

πŸš€** Introduction**
If you’ve built a static website using HTML, CSS, and images, the next step is getting it online. One of the simplest and most cost-effective ways is to use Amazon S3 (Simple Storage Service).

With just a few clicks, you can deploy your static site and make it accessible to the world β€” no servers required!

Let’s go step by step.

πŸ›  Step 1: Prepare Your Files
Make sure your project folder contains all necessary files, such as:

index.html
style.css
Any images or assets
πŸ‘‰ Keep them organized in a single folder before uploading.

🧩 Step 2: Create an S3 Bucket
Log in to AWS Management Console β†’ S3
Click Create bucket
Enter a unique bucket name (example: portfolio-website)
Uncheck Block all public access if you want your site to be public
Click Create bucket

βš™οΈ Step 3: Configure Bucket for Static Website Hosting
Open your newly created bucket
Go to the Properties tab
Scroll to Static website hosting β†’ Edit
Enable it and set:
Index document β†’ index.html
Error document β†’ 404.html (optional)
Save changes

πŸ”“ Step 4: Make Files Public
There are two ways to allow public access:

Option 1: Manually
Select all objects β†’ Click Actions β†’ Make public

Option 2: Bucket Policy (Recommended)
Go to Permissions β†’ Bucket Policy
Paste the following JSON (replace YOUR_BUCKET_NAME):

Save changes

πŸ“€ Step 5: Upload Your Files
Go to the Objects tab
Click Upload β†’ Add files
Select all your project files (index.html, style.css, images, etc.)
Click Upload

🌍 Step 6: Access Your App
Open the Properties tab of your bucket
Scroll to Static website hosting
Copy the Bucket website endpoint URL
Paste it into your browser β€” your site is live πŸŽ‰

🎯 Conclusion
Hosting a static website on AWS S3 is one of the fastest ways to make your portfolio, landing page, or small project available online.

It’s cost-efficient, secure, and scalable β€” making it perfect for developers of all levels.

http://my-portfolio-deepak1919.s3-website.ap-south-1.amazonaws.com

Top comments (0)