Create a Static Website Using Amazon S3
Durga Vellingiri

Durga Vellingiri @durga_v

About: Whatever Happens,Happens for the Best.!

Joined:
Jan 22, 2025

Create a Static Website Using Amazon S3

Publish Date: Apr 17
2 0

Amazon S3 (Simple Storage Service) allows you to host static websites easily and cost-effectively. Whether it’s a personal portfolio, project landing page, or simple blog, here’s a step-by-step guide to help you set it up in minutes!


To create a bucket

  1. Sign in to the AWS Management Console and open the Amazon S3 console: https://console.aws.amazon.com/s3/
  2. Click Create bucket.
  3. Enter your Bucket name (e.g., example.com).
  4. Choose your desired AWS Region.
  5. Click Create to proceed with the default settings.

Create Bucket


🌐 To enable bucket versioning

  1. In the buckets list, click the bucket you just created.
  2. Go to the Properties tab.
  3. Scroll to Static website hosting and click Edit.
  4. Choose Use this bucket to host a website.
  5. Enable Static website hosting.
  6. In the Index document, enter index.html.
  7. Click Save changes.
  8. You’ll now see a Website endpoint at the bottom of the section.

Enable Hosting


🔓 Edit Block Public Access settings

  1. In the buckets list, click your bucket name.
  2. Go to the Permissions tab.
  3. Under Block public access (bucket settings), click Edit.
  4. Uncheck Block all public access.
  5. Confirm and click Save changes.

Block Access 1

Block Access 2


🔐 Add a bucket policy that makes your bucket content publicly available

  1. Under your bucket, go to the Permissions tab.
  2. Scroll to Bucket policy and click Edit.
  3. Paste the following JSON policy (replace Bucket-Name with your actual bucket name):
{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Sid": "PublicReadGetObject",
      "Effect": "Allow",
      "Principal": "*",
      "Action": ["s3:GetObject"],
      "Resource": ["arn:aws:s3:::Bucket-Name/*"]
    }
  ]
}
Enter fullscreen mode Exit fullscreen mode
  1. Click Save.

Bucket Policy


📁 Configure an index document

  1. Create an index.html file. Here's a simple example:
<!DOCTYPE html>
<html>
<head>
  <title>My Website</title>
</head>
<body>
  <h1>Welcome to my website!</h1>
  <p>Now hosted on Amazon S3!</p>
</body>
</html>
Enter fullscreen mode Exit fullscreen mode
  1. Go back to your bucket and make sure website hosting is enabled with index.html set as your index document.
  2. Upload the file:
    • Drag and drop it into the bucket, or
    • Click Upload, choose the file, and complete the upload process.

Upload File


🌍 Test your website endpoint

  1. In your bucket, go to the Properties tab.
  2. Scroll to Static website hosting.
  3. Click your Bucket website endpoint.
  4. Your website should now open in a new tab, live and hosted!

Website Test


✅ Conclusion

That’s it! 🎉 You’ve successfully hosted your static website using Amazon S3.

This setup is not only free or low-cost (especially with the AWS Free Tier), but also super scalable and efficient for quick deployments. Whether you're showcasing your portfolio, sharing a project, or building a micro site — S3 makes it incredibly easy.

You can now customize your HTML file, add more pages, or even integrate it with a custom domain and SSL using Amazon Route 53 + CloudFront.

Happy hosting! 💻✨

Comments 0 total

    Add comment