How to Host a Website on Amazon S3
Hosting a website on Amazon S3 is a great way to share your site with the world. It’s simple, cost-effective, and scalable. Here’s a step-by-step guide written in easy language to help you host your website on Amazon S3.
1. What is Amazon S3?
Amazon S3 (Simple Storage Service) is a service by AWS that allows you to store files. You can use it to host your static website. A static website means the content doesn’t change dynamically (like HTML, CSS, and JavaScript files).
Steps to Host Your Website:
Step 1: Log in to AWS
Go to the AWS Management Console.
Sign in with your credentials. If you don’t have an account, create one—it’s free to start.
Step 2: Create a Bucket
Search for S3 in the search bar.
Click on "Create Bucket."
Bucket Name: Give your bucket a unique name (e.g., mywebsite123).
Region: Choose a nearby region.
Uncheck "Block all public access" so your website is visible.
Click "Create Bucket.”
Step 3: Upload Your Website Files
Click on your bucket name.
Go to the "Upload" section.
Add your website files (e.g.,
index.html
,styles.css
, images).Click "Upload" to save them in the bucket.
Step 4: Configure Your Bucket for Hosting
Go to the "Properties" tab in your bucket.
Scroll down to "Static website hosting" and click "Edit."
Choose "Enable" for static website hosting.
Set the index document (e.g.,
index.html
).- If you have an error page, you can set it here (e.g.,
404.html
).
- If you have an error page, you can set it here (e.g.,
Save the changes.
Step 5: Make Your Files Public
Go to the "Permissions" tab.
Edit the Bucket Policy:
Copy and paste this policy (replacemywebsite123
with your bucket name):jsonCopy code{ "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Principal": "*", "Action": "s3:GetObject", "Resource": "arn:aws:s3:::mywebsite123/*" } ] }
Save it. This allows people to access your website.
Step 6: Test Your Website
Go back to the "Properties" tab and find the Bucket Website Endpoint.
Click the link, and your website should open!
What’s Next?
Custom Domain: You can link your own domain (e.g., www.mywebsite.com) by configuring Route 53 or other DNS services.
HTTPS: Use Amazon CloudFront to add SSL for a secure connection.
Hosting your site on Amazon S3 is that simple. No complex setup, no big bills—just your website, ready to go live! 🚀 !!
Happy coding!! 🌻
Subscribe to my newsletter
Read articles from Pooja Raut directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by
Pooja Raut
Pooja Raut
👨💻 BE Student | Enthusiastic about DevOps and Full-Stack Development | Passionate about Technology and Innovation | Exploring the world of development and operations to create seamless software solutions.