AWS Day 39: Hosting a Static Website on AWS S3

"I'm a 3rd-year Computer Engineering student at Marwadi University with skills in C++, web development (MERN stack), and DevOps tools like Kubernetes. I contribute to open-source projects and share tech knowledge on GitHub and LinkedIn. I'm learning cloud technologies and app deployment. As an Internshala Student Partner, I help others find jobs and courses." now currently focusing on #90DaysOfDevops
Static websites are one of the simplest and most cost-effective ways to host web content in the cloud. Instead of managing virtual machines or web servers, Amazon S3 allows you to store HTML, CSS, JavaScript, images, and other static assets while serving them directly to users.
This approach is ideal for personal portfolios, documentation sites, landing pages, and internal information portals because it requires minimal infrastructure management and offers high availability.
In this hands-on lab, I created an Amazon S3 bucket, enabled static website hosting, uploaded an HTML page, configured public access, and successfully accessed the website using the Amazon S3 website endpoint.
Step 1 – Create an Amazon S3 Bucket
Created a new S3 bucket named:
nautilus-web-1451225450
The bucket was created in the US East (N. Virginia) Region using the default General Purpose bucket type.
Step 2 – Upload Website Files
Uploaded the index.html file from the AWS client to the S3 bucket using the AWS CLI.
aws s3 cp index.html s3://nautilus-web-1451225450/
This uploaded the main web page that will be served as the website's home page.
Step 3 – Configure Public Access
By default, Amazon S3 blocks all public access to protect stored objects.
To make the website publicly accessible:
Disabled Block Public Access
Saved the updated bucket settings
This allows external users to access the website through the S3 website endpoint.
Step 4 – Enable Static Website Hosting
Enabled Static Website Hosting for the bucket.
Configured:
Hosting Type: Host a Static Website
Index Document:
index.html
Amazon S3 automatically generated a website endpoint for serving the static website.
Step 5 – Configure Bucket Permissions
Since static websites must be publicly accessible, the bucket requires permissions that allow users to read website files.
A bucket policy was applied to allow public GetObject access for all objects inside the bucket.
Example policy:
{
"Version":"2012-10-17",
"Statement":[
{
"Sid":"PublicRead",
"Effect":"Allow",
"Principal":"*",
"Action":"s3:GetObject",
"Resource":"arn:aws:s3:::nautilus-web-1451225450/*"
}
]
}
Note: Public bucket policies should only be used for websites intended for public access.
Step 6 – Verify Website
After enabling static website hosting and configuring permissions, the generated S3 website endpoint displayed the uploaded web page successfully.
The homepage loaded correctly using:
http://bucket-name.s3-website-region.amazonaws.com
Conclusion
Amazon S3 Static Website Hosting provides a simple, scalable, and cost-effective solution for hosting static websites without managing servers. By creating an S3 bucket, uploading website files, configuring public access, and enabling static website hosting, you can publish web content in just a few steps.
For production workloads, combining Amazon S3 with Amazon CloudFront and AWS Certificate Manager (ACM) enables HTTPS, global content delivery, and improved security, making it a powerful solution for modern static web applications.




