DEV Community

Sushant Deshpande
Sushant Deshpande

Posted on

Deploying a Static Website on Amazon S3 – Step by Step Guide (Beginner Friendly)

Deploying a Static Website on Amazon S3 – Step by Step Guide

In this article, I will explain how I deployed a modern static website using Amazon S3 Static Website Hosting with serverless architecture.


📌 Why Use Amazon S3 for Static Websites?

Amazon S3 allows you to host static websites without managing any server.

Benefits:

  • No server maintenance
  • Cost efficient
  • Highly scalable
  • Easy deployment
  • Fully serverless architecture

🏗 Project Overview

This project includes:

  • index.html
  • login.html
  • style.css
  • Static Website Hosting enabled
  • Public bucket policy configuration
  • Content-Type metadata configuration

⚙️ Step-by-Step Deployment Process

1️⃣ Create S3 Bucket

  • Disabled Block Public Access
  • Enabled Static Website Hosting
  • Set index document as index.html

2️⃣ Upload Website Files

Uploaded:

  • index.html
  • login.html
  • style.css

3️⃣ Configure Bucket Policy

Added public read access policy to allow website access.

4️⃣ Fix Content-Type Issue

Initially, HTML was rendering as plain text because Content-Type was set to text/plain.

Updated metadata to:

  • text/html
  • text/css

This resolved the rendering issue.


🔄 EC2 vs S3 Hosting

Previously, I deployed my website on EC2.

Now I migrated to Amazon S3 for serverless hosting.

EC2 S3
Requires server Serverless
Needs configuration Simple setup
Higher cost Cost efficient

🧠 Key Learnings

  • Difference between server and serverless hosting
  • Importance of Content-Type metadata
  • Understanding S3 bucket permissions
  • Real-world deployment troubleshooting

🔗 GitHub Repository

https://github.com/susshantdeshpande/aws-s3-static-website


🎯 Conclusion

Deploying a static website using Amazon S3 helped me understand cloud fundamentals and serverless architecture in a practical way.

Next, I plan to integrate:

  • CloudFront CDN
  • HTTPS (SSL)
  • Custom Domain using Route53

👨‍💻 Developed by Sushant Deshpande

Cloud Engineering Learner

Top comments (0)