The brief
OpenHR is a hiring platform whose users’ data has to stay in their own region. I wrote the Terraform that runs it on AWS, in its own repository, and wrote down every decision and why in a DECISIONS.md file.
What I built
Compute. Everything runs on ECS Fargate: the API, an email worker, the ClamAV scanner and the admin tools. I started with App Runner and dropped it, because it cannot host a background worker or the scanner.
Data residency. Each real region gets its own RDS Postgres instance, and a global database sits with the API in the home region. Production launches in the UK and EU (eu-west-2 and eu-central-1), joined by VPC peering. The other three regions are placeholders served from the home region, with a documented risk so nobody offers those markets by accident.
The edge. CloudFront and AWS WAF sit in front of the load balancer, with managed rules and rate limits. The load balancer only accepts traffic that arrives through CloudFront.
Jobs and releases. Scheduled work runs as ECS tasks started by EventBridge Scheduler. Database migrations run as a one-off ECS task triggered from GitHub Actions over OIDC, so the database stays private and no long-lived keys exist.
Secrets. Terraform creates the secrets empty and the values are set separately, so they never enter state.
A staging environment that sleeps
Staging runs on Fargate Spot, a small RDS instance and Redis on a Spot task backed by EFS. A Lambda function scales everything to zero after an hour with no logged-in traffic and stops the database. Visitors see a “wake staging” page. This took staging from about $90 a month to about $55 while idle.
Where it stands
Staging is deployed. Production passes terraform validate but has not been planned or applied yet.