This site - an Astro build served from a private S3 bucket through CloudFront, deployed on every push.
AstroAWSS3CloudFrontGitHub ActionsCloudflare
overview
This site is a static portfolio built with Astro. It's served from a private Amazon S3 bucket through CloudFront on my own domain, enearina.com, and it's deployed automatically every time I push a change.
How it works
When someone visits, Cloudflare DNS points enearina.com to Amazon CloudFront, which serves the site over HTTPS from a private S3 bucket. When I push to main, GitHub Actions builds the site, uploads it to S3 and clears the CloudFront cache.
How I built it
Built the site with Astro as plain static pages.
Registered enearina.com on Cloudflare and kept DNS there.
Created a private S3 bucket with public access blocked.
Requested an HTTPS certificate in AWS Certificate Manager, validated through a DNS record in Cloudflare.
Created a CloudFront distribution in front of the bucket, with Origin Access Control, HTTPS redirect and a custom 404 page.
Pointed enearina.com at CloudFront with a DNS-only record.
Connected GitHub Actions to AWS with OIDC and a deploy role limited to this bucket and distribution.
Set an AWS budget alert at $1.
Security
Private bucket: only CloudFront can read the files, through Origin Access Control (OAC).
No stored AWS keys: GitHub Actions signs in with OIDC and gets short-lived credentials for each deploy.
HTTPS only: every visit is served over an encrypted connection.
Cost
It runs for about $0 a month on CloudFront's free plan; the domain is the only cost.