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

Suhailul Aslam KC

June 9, 2025

Hosting a static website on AWS S3 is one of the easiest, cheapest, and most scalable ways to put your website online. Whether you’re building a personal portfolio, a landing page, or a documentation site, Amazon S3 (Simple Storage Service) provides a secure, high-availability solution with near-zero maintenance.

If you’re tired of managing servers and want a fast, serverless hosting option, AWS S3 is the perfect fit. In this guide, you’ll learn what a static website is, why S3 is ideal for hosting, and how to configure and deploy your website step by step.


What Is a Static Website?

A static website consists of fixed files such as:

  • HTML
  • CSS
  • JavaScript
  • Images
  • JSON or text files

There are no backend scripts like PHP or Node.js running on the server. Since static sites don’t need server processing, they load fast and are very easy to host.

Examples of static website use cases:

  • Portfolios
  • Business landing pages
  • Documentation sites
  • Static blogs (Hugo, Jekyll, Astro, etc.)
  • Product marketing websites

Why Host a Static Website on AWS S3?

Here’s why S3 is one of the best platforms for static hosting:

Extremely Low Cost

You only pay for what you store and the bandwidth you use. Many small sites cost less than ₹50/month or even stay within the AWS Free Tier.

Highly Scalable

Whether you get 10 visitors or 10 million, S3 can handle the traffic automatically.

Serverless Hosting

No servers to manage, patch, or secure.

Integration with CloudFront & Route 53

You can easily add:

  • CDN for improved global speed
  • Custom domain
  • HTTPS with SSL certificates

High Durability

S3 guarantees 99.999999999% (11 nines) durability, meaning your files are extremely safe.


Step-by-Step Guide: Hosting a Static Website on AWS S3

Below are the complete steps to deploy your static website using S3.


Step 1: Create an S3 Bucket

  1. Go to AWS Console
  2. Navigate to Services → S3
  3. Click Create bucket

Now configure:

Bucket Name

  • Must be unique globally
  • For websites with a custom domain, name it exactly the same as your domain
    Example: example.com

Region

Choose the nearest region for better latency.

Bucket Settings

Make sure to uncheck Block all public access
(because static files need to be public).

AWS will show a warning — acknowledge it.

Finally, click Create Bucket.


Step 2: Enable Static Website Hosting

  1. Open your bucket → Properties tab
  2. Scroll down to Static website hosting
  3. Click Edit
  4. Enable it and select:
    Host a static website
  5. Enter:
Index document: index.html
Error document: error.html (optional)
  1. Save changes.

You will now see a Website endpoint URL like:

http://example-bucket.s3-website-us-east-1.amazonaws.com

This URL will host your static website.


Step 3: Upload Your Website Files

  1. Go to the Objects tab
  2. Click Upload
  3. Upload:
  • index.html
  • CSS files
  • JS files
  • Images
  • Any static assets

Once uploaded, your bucket has all the website content — but they aren’t public yet.


Step 4: Make Files Public (Bucket Policy)

Static hosting requires public access to files.

Go to:

Permissions → Bucket Policy → Edit

Paste this policy (replace your-bucket-name accordingly):

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

Save the policy.

Now your objects are publicly readable.


Step 5: Test Your Static Website

Open the Website endpoint shown in the bucket properties.

Your static website should load instantly!


Step 6 (Optional but Recommended): Add a Custom Domain Using Route 53

If you want your website accessible at:

https://www.yourdomain.com

You can integrate Route 53.

Steps to connect:

  1. Buy a domain from Route 53 (or any provider).
  2. Create a hosted zone (if not automatically created).
  3. Add an A Record (Alias) pointing to your S3 website endpoint.

Important:
This only works if your bucket name matches your domain name exactly.


Step 7 (Optional): Add HTTPS Using CloudFront

S3 static hosting URLs do not support HTTPS by default.
To enable SSL for your domain:

You must use CloudFront CDN.

CloudFront will:

  • Improve global speed
  • Serve your site over HTTPS
  • Cache static content
  • Reduce costs for large traffic

Steps:

  1. Go to CloudFront → Create Distribution
  2. Origin domain = Your S3 static website endpoint
  3. Viewer protocol policy = Redirect HTTP to HTTPS
  4. Add custom domain in Alternate domain names (CNAMEs)
  5. Request SSL certificate via AWS Certificate Manager (ACM)
  6. Attach certificate in CloudFront settings
  7. Update Route 53 A Record → Alias to CloudFront distribution

Now your site loads on:

https://yourdomain.com

Step 8 (Optional): Automate Deployment

For static site developers, you can automate deployments using:

1. AWS CLI

aws s3 sync ./dist s3://your-bucket-name --delete

2. GitHub Actions

Auto-deploy when you push changes.

3. CI/CD Tools

  • GitLab CI
  • Bitbucket Pipelines
  • AWS CodePipeline

This is especially useful for sites built with:

  • React
  • Vue
  • Angular
  • Next.js (static export)
  • Astro
  • Jekyll
  • Hugo

How Much Does S3 Website Hosting Cost?

For most small to medium websites:

💰 ₹0 to ₹100 per month
(depends on traffic + storage)

AWS Free Tier includes:

  • 5GB storage
  • 15GB data transfer
  • 20,000 GET requests

Perfect for small websites.


Final Thoughts

Hosting a static website on AWS S3 is one of the smartest choices for developers, businesses, and creators who want:

  • A fast, secure website
  • Minimal maintenance
  • Near-zero downtime
  • Low monthly cost
  • Built-in scalability
  • Easy global distribution

By following the steps above — creating a bucket, enabling static hosting, uploading files, making content public, and optionally adding CloudFront + Route 53 — you can deploy a professional, production-ready static website in minutes.