Architecture#
Everything is serverless, everything is in one AWS account, and everything is in us-east-1. There are no servers to patch, no VPC, no NAT gateway, and no load balancer — the three line items that usually dominate a small AWS bill.
The whole system#
flowchart TB
subgraph client["Visitor"]
B["Browser<br/>TLS 1.3 · HTTP/3"]
end
subgraph dns["DNS — Route 53"]
Z["Public hosted zone<br/>DNSSEC signed"]
K["KMS key-signing key<br/>ECDSA P-256"]
R["A · AAAA · HTTPS<br/>CAA · null MX · SPF<br/>DKIM · DMARC"]
Z --- K
Z --- R
end
subgraph edge["Edge — CloudFront"]
D["Distribution<br/>TLSv1.3_2025<br/>http2and3"]
F["Viewer-request function<br/>www→apex, dir→index.html"]
H["Response headers policy<br/>CSP · HSTS · COOP/COEP/CORP"]
D --- F
D --- H
end
subgraph origin["Origins"]
S["S3 bucket<br/>private · no ACLs"]
L["Lambda Function URL<br/>/api/whoami · arm64"]
end
subgraph ops["Guardrails"]
A["CloudWatch alarms<br/>DNSSEC · cert expiry"]
G["Budget tripwire<br/>$5/month"]
P["DNSSEC probe, hourly<br/>Scheduler → Lambda"]
N["SNS → email"]
A --> N
G --> N
P -->|"via two alarms"| N
end
V["Public validating resolvers<br/>Cloudflare · Google · NextDNS"]
P -->|"DoH: does it validate?"| V
V -.->|"resolve"| Z
B -->|"resolve"| Z
B -->|"HTTPS"| D
D -->|"SigV4 via OAC"| S
D -->|"SigV4 via OAC"| L
R -.->|"alias"| D
Z -.-> AWhy each choice#
| Component | Choice | Reasoning |
|---|---|---|
| Hosting | S3 + CloudFront | Cheapest way to serve static content with a real CDN. Free tier covers 1 TB egress and 10M requests per month, so practical cost is zero. |
| Origin access | OAC with SigV4 | The bucket is private. OAC replaces the legacy Origin Access Identity and pins access to one distribution ARN. |
| TLS | TLSv1.3_2025 | TLS 1.3 only, hybrid post-quantum key exchange included at no cost. See ADR-0004. |
| Certificate | ACM, ECDSA P-256 | Smaller handshake than RSA, and matches the DNSSEC key's curve. Free. |
| DNS | Route 53, DNSSEC signed | $0.50/month for the zone, $1.00/month for the KMS signing key. |
| External DNSSEC check | EventBridge Scheduler + Lambda, hourly | Sees a broken chain of trust at the registrar, which Route 53's own alarms cannot. GitHub ran the scheduled check hours late. Free tier. ADR-0020. |
| Edge logic | CloudFront Function | ~1/6th the price of Lambda@Edge and sufficient for redirects and URL rewriting. |
| Dynamic API | Lambda Function URL + OAC | No API Gateway, so no per-request gateway charge. Free tier covers it. |
| State | S3 with native locking | No DynamoDB table. See ADR-0005. |
| CI auth | GitHub OIDC | No IAM users, no access keys. See ADR-0006. |
| Account bootstrap | OpenTofu seed, then GitHub Actions | One manual tofu apply per account; every later change runs in a workflow. See ADR-0014. |
| IaC tool | OpenTofu | Open-source, community-governed; same HCL. See ADR-0015. |
Request lifecycle#
- Resolution. The resolver queries the signed zone. It gets A, AAAA and
HTTPS records, all with RRSIG signatures it can validate up the chain to the .dev registry. The HTTPS record carries alpn=h2,h3, so a supporting client knows HTTP/3 is available before connecting.
- Connection. The client opens QUIC (or TCP if it must) directly to a
CloudFront edge. The handshake is TLS 1.3 only, with X25519MLKEM768 hybrid key agreement where the client supports it.
- Edge function. A CloudFront Function canonicalises
wwwto the apex and
rewrites directory URLs to index.html.
- Origin. On a cache miss, CloudFront signs a SigV4 request to the private
S3 bucket. /api/* instead goes to a Lambda Function URL, also over OAC.
- Response. The response headers policy attaches the CSP, HSTS and
cross-origin isolation headers, and strips origin fingerprinting headers.
What is deliberately absent#
- No VPC. Nothing here needs one, and a NAT gateway alone would cost ~$32/month —
twenty times the entire rest of the stack.
- No WAF. No injectable surface to protect. ADR-0009.
- No API Gateway. A Lambda Function URL behind CloudFront does the same job
with no per-request gateway charge.
- No DynamoDB. State locking is native to the S3 backend now.
- No multi-region anything. CloudFront is already global; the origin being in
one region is not a latency problem. ADR-0010.
Layers and apply order#
terraform/
├── bootstrap/ ← applied once, by a human, with local state
│ └── state bucket, GitHub OIDC provider, plan + apply roles, boundary
├── environments/prod/ ← applied by CI, state in S3
│ └── composes the modules below
└── modules/
├── dns-zone ← hosted zone, DNSSEC, KMS KSK
├── tls-certificate ← ACM certificate, DNS validation
├── static-site ← S3, CloudFront, headers, edge function
├── edge-api ← /api/whoami Lambda
├── dns-records ← every record in the zone
├── guardrails ← alarms, budget, SNS
└── dnssec-probe ← hourly check that resolvers validate the zone
The dependency chain inside environments/prod is forced by AWS, not by preference: the zone must exist before the certificate can be DNS-validated, the certificate must be issued before CloudFront will accept it, and the distribution must exist before records can alias to it.