Static Portfolio Site on S3 + CloudFront
Part of the AWS Roadmap
In short
A personal site on your own domain, served over HTTPS from AWS, costs very little and proves several real skills at once. It is the first project recruiters can actually click.
A project that hosts your personal portfolio as a static site in a private S3 bucket served through CloudFront with HTTPS. It covers bucket policies, origin access control, caching and cache invalidation.

Think of it like this
A locked godown with one shopfront
Your goods sit in a locked godown on the edge of Indore. Nobody walks in. Customers only visit your shiny shopfront in the market, and only your own staff carry stock from the godown to the shop. The private S3 bucket is the godown, CloudFront is the shopfront, and origin access control is the staff pass.
Watch it happen
Building the portfolio stack
1/5Create an S3 bucket with Block Public Access left on. Upload your built site.
The big ideas
What you need to know
Keep the bucket private
With origin access control, only your CloudFront distribution can read the bucket. Don't turn on S3 static website hosting for this setup.
The bucket policy
Allows s3:GetObject to the CloudFront service principal, limited by AWS:SourceArn to your one distribution.
HTTPS everywhere
Viewer protocol policy 'Redirect HTTP to HTTPS' plus an ACM certificate for your custom domain.
Custom error pages
Map 403 and 404 responses to a friendly 404.html, or to index.html for a single-page app.
See it in code
Walk through the code
1{2 "Version": "2012-10-17",3 "Statement": [4 {5 "Sid": "AllowCloudFrontRead",6 "Effect": "Allow",7 "Principal": { "Service": "cloudfront.amazonaws.com" },8 "Action": "s3:GetObject",9 "Resource": "arn:aws:s3:::ananya-portfolio-site/*",10 "Condition": {11 "StringEquals": {12 "AWS:SourceArn": "arn:aws:cloudfront::111122223333:distribution/E1ABCDEFGHIJKL"13 }14 }15 }16 ]17}1/3The CloudFront service is the only principal allowed in.
The bucket policy for origin access control. The CloudFront console offers to copy exactly this for you.
Save yourself the pain
Common mistakes
Oops
Making the bucket public so CloudFront can read it.
Do this instead
Keep Block Public Access on and use origin access control with a bucket policy scoped to your distribution.
Oops
Using the S3 website endpoint as origin and then wondering why OAC doesn't work.
Do this instead
OAC works with the S3 REST endpoint (bucket.s3.ap-south-1.amazonaws.com). Choose the bucket itself as origin.
Oops
Leaving the project with no README or diagram.
Do this instead
Add a short README with the architecture, a diagram and the deploy command. That's what turns it into a portfolio piece.
Your mission
Ship your portfolio
Quick check
With OAC set up correctly, what happens when someone opens the S3 object URL directly?
Go deeper
- 1Keep the bucket private and allow access only from CloudFront through origin access control.
- 2Add a custom domain with an ACM certificate (issued in us-east-1 for CloudFront) if you own a domain.
- 3Automate uploads with aws s3 sync and a CloudFront invalidation from a GitHub Actions workflow.
Stuck on this topic? Ask an Insider
Get 1:1 guidance from people who've walked this exact path — on the InsideEdge app.