posts /

How This Blog Is Built (and Why It's Boring on Purpose)

A private S3 bucket, CloudFront, a free TLS certificate and Hugo. About a dollar a month, nothing to patch, and very little that can break.

Every developer blog’s first post is about how the blog is built. This is that post, but with the costs, the tradeoffs and the parts that tripped me up.

The claim#

The architecture#

text
reader ──HTTPS──▶ CloudFront ──signed──▶ private S3 bucket
                     │
                     └─ Function: www → apex
                                  /post/ → /post/index.html
  • Route 53 points theskepticaldev.com at CloudFront.
  • ACM issues the TLS certificate, for free.
  • S3 holds the built site. The bucket is private; only this one CloudFront distribution can read it.
  • Terraform describes all of the above, so it can be rebuilt from scratch.

Locking the bucket to one distribution#

CloudFront signs every request it sends to S3 (Origin Access Control). The bucket policy then only accepts requests that come from this distribution:

terraform/s3.tf
condition {
  test     = "StringEquals"
  variable = "AWS:SourceArn"
  values   = [aws_cloudfront_distribution.site.arn]
}

Without that condition, any CloudFront distribution in any AWS account could read the bucket.

Pretty URLs#

Hugo writes /posts/how-this-blog-is-built/index.html, but readers visit /posts/how-this-blog-is-built/. S3 doesn’t fill in index.html when accessed this way, so a small CloudFront Function does it on every request:

terraform/functions/rewrite.js
var uri = request.uri;
if (uri.endsWith("/")) {
  request.uri = uri + "index.html";
} else if (!uri.split("/").pop().includes(".")) {
  request.uri = uri + "/index.html";
}

Publishing a post#

bash
hugo new content posts/2026-12-10-some-topic/index.md
hugo server -D        # preview locally, drafts included
git commit -am "Add: some topic" && git push

On push, GitHub Actions builds the site, syncs it to S3 and clears the CloudFront cache. It authenticates with short-lived credentials (OIDC), so no AWS keys are stored in GitHub.

FilesCache-ControlWhy
css/*, js/*max-age=31536000, immutableFile names contain a content hash, so a change means a new URL
Everything elsemax-age=300, s-maxage=86400Browsers re-check after 5 minutes; CloudFront is cleared on every deploy

What it costs#

ItemMonthly cost
Route 53 hosted zone$0.50
ACM certificate$0
CloudFront (1 TB and 10M requests free)$0 at blog-scale traffic
S3 storage and requestsA few cents

Tradeoffs#

  • No comments and no search, yet. Both can be added later without a server (for example, Pagefind for search).
  • Every change is a rebuild. For a blog that takes seconds, so it doesn’t matter.
  • Scheduled posts need a scheduled build. A post dated in the future only appears after the next build, so the pipeline also runs once a day.

If any of this turns out to be wrong, the link below goes straight to this post’s source.