In the previous post I built the site. But a few improvements were needed:
- The website should use https instead of http.
- The S3 bucket should not allow public access.
So CloudFront is the way to go.
I followed this AWS guide, using a REST API endpoint as the origin with access restricted by an origin access control (OAC). These were the steps:
- Apply for two SSL certificates from ACM — one for album69.com and one for *.album69.com.
- Create two CloudFront distributions — one for album69.com and one for www.album69.com. I chose OAC instead of OAI, which is the legacy setting.
- Set the alternate domain names — album69.com and www.album69.com, each with its corresponding SSL certificate.
- Update DNS in Route 53 — point the A records to the CloudFront distributions.
Automation
The infrastructure itself — S3 buckets, CloudFront distributions, Route 53 records — was built with Terraform (that’s another article). For day-to-day publishing, deploy.sh handles the build, sync, and CloudFront invalidation in one command.