projects/portfolio-aws
enearina.com · AWS

Portfolio on AWS

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.

Architecture diagram. Visitors look up enearina.com in Cloudflare DNS, which points to Amazon CloudFront, then load the site over HTTPS from CloudFront, which reads the files from a private Amazon S3 bucket through Origin Access Control. To deploy, a git push runs GitHub Actions, which signs in to AWS with OIDC, syncs the site to S3 and clears the CloudFront cache.

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

  1. Built the site with Astro as plain static pages.
  2. Registered enearina.com on Cloudflare and kept DNS there.
  3. Created a private S3 bucket with public access blocked.
  4. Requested an HTTPS certificate in AWS Certificate Manager, validated through a DNS record in Cloudflare.
  5. Created a CloudFront distribution in front of the bucket, with Origin Access Control, HTTPS redirect and a custom 404 page.
  6. Pointed enearina.com at CloudFront with a DNS-only record.
  7. Connected GitHub Actions to AWS with OIDC and a deploy role limited to this bucket and distribution.
  8. 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.