As part of my AWS learning journey, I built and deployed a static portfolio website using Amazon S3 and secured access using IAM best practices.
This project helped me understand S3 static hosting, bucket policies, IAM permissions, and real-world troubleshooting.
In this article, Iβll walk you through every step I followed, from scratch to a working live website.
π§ What You Will Learn
What static website hosting is
How to host a website using Amazon S3
How IAM permissions affect S3 access
How to troubleshoot Access Denied errors
How to apply least-privilege IAM access
π οΈ Technologies Used
Amazon S3
AWS IAM
HTML & CSS
Git & GitHub
AWS Console
π Project Overview
The goal was to host a simple portfolio website containing:
Profile section
About me
Project details
The site is publicly accessible using an S3 static website endpoint.
π§± Step 1: Create an S3 Bucket
Go to AWS Console β S3
Click Create bucket
Provide:
Bucket name (must be globally unique)
Region (I used us-east-1)
Uncheck Block all public access
Acknowledge the warning
Click Create bucket
π Step 2: Enable Static Website Hosting
Open the bucket
Go to Properties
Scroll to Static website hosting
Enable it
Set:
Index document: index.html
Save changes
You will get a website endpoint URL β keep this.
π Step 3: Upload Website Files
I created a simple index.html file containing HTML and CSS for my portfolio.
Folder structure:
aws-s3-static-portfolio/
βββ index.html
βββ assets/
β βββ profile.png
Upload all files to the S3 bucket.
π Step 4: Fix Access Denied (Bucket Policy)
Initially, I got this error:
AccessDenied
To fix this, I added a bucket policy to allow public read access.
β
Bucket Policy Used
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "PublicReadAccess",
"Effect": "Allow",
"Principal": "",
"Action": "s3:GetObject",
"Resource": "arn:aws:s3:::your-bucket-name/"
}
]
}
After saving this, the website loaded successfully π
π€ Step 5: IAM User with Least Privilege
To follow security best practices, I created a dedicated IAM user.
IAM Steps:
Go to IAM β Users
Create a new user
Enable AWS Management Console access
Attach AmazonS3ReadOnlyAccess
Login using the IAM user
π΄ Initially, I couldnβt see buckets due to missing permission:
s3:ListAllMyBuckets
After attaching the correct policy, it worked perfectly.
π§ͺ Step 6: Verification
Website opened successfully via S3 endpoint
IAM user could access only S3
Images loaded correctly from assets/ folder
π Final Output
β
Live static website
β
Secure IAM permissions
β
Public read-only S3 access
This project gave me hands-on experience with real AWS troubleshooting, not just theory.
π Key Learnings
S3 is case-sensitive (important for images)
IAM permissions directly impact service visibility
Bucket policies override ACLs
Least privilege is critical for security
π GitHub Repository
π (Add your GitHub repo link here)
π Conclusion
This was a beginner-friendly but very practical AWS project.
It helped me understand how AWS services connect in real scenarios.
If youβre learning AWS, I highly recommend trying this project yourself π
GitHub--https://github.com/IrfanPasha05/aws-s3-static-portfolio/tree/main
π Thanks for reading!
Feel free to connect or suggest improvements.
Top comments (0)