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 -.-> A
Mermaid diagram source. Renders as a diagram in the repository on GitHub; shown as source here because this site ships no third-party JavaScript.

Why each choice#

ComponentChoiceReasoning
HostingS3 + CloudFrontCheapest 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 accessOAC with SigV4The bucket is private. OAC replaces the legacy Origin Access Identity and pins access to one distribution ARN.
TLSTLSv1.3_2025TLS 1.3 only, hybrid post-quantum key exchange included at no cost. See ADR-0004.
CertificateACM, ECDSA P-256Smaller handshake than RSA, and matches the DNSSEC key's curve. Free.
DNSRoute 53, DNSSEC signed$0.50/month for the zone, $1.00/month for the KMS signing key.
External DNSSEC checkEventBridge Scheduler + Lambda, hourlySees 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 logicCloudFront Function~1/6th the price of Lambda@Edge and sufficient for redirects and URL rewriting.
Dynamic APILambda Function URL + OACNo API Gateway, so no per-request gateway charge. Free tier covers it.
StateS3 with native lockingNo DynamoDB table. See ADR-0005.
CI authGitHub OIDCNo IAM users, no access keys. See ADR-0006.
Account bootstrapOpenTofu seed, then GitHub ActionsOne manual tofu apply per account; every later change runs in a workflow. See ADR-0014.
IaC toolOpenTofuOpen-source, community-governed; same HCL. See ADR-0015.

Request lifecycle#

  1. 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.

  1. 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.

  1. Edge function. A CloudFront Function canonicalises www to the apex and

rewrites directory URLs to index.html.

  1. 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.

  1. 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.

Built 2026-11-25 from commit 33bfabf6a27d4baeecf228c31bd5d636a3965070. This page was generated from the same source that provisions the infrastructure it describes.