Deployment architecture
Three services, one load balancer, and a managed data layer — all defined in Terraform.
The services
Why the worker is separate
Generating a course takes minutes. If that ran in the API, a burst of course creation would starve interactive requests — the dashboard would hang because someone else uploaded a syllabus. Separate services mean the two scale independently.
Data layer
Infrastructure as code
Everything is Terraform, split into modules — network, database, compute, storage, cognito, secrets, waf, observability, security and dns. A change to certificate policy is reviewable independently of a change to task sizing.
- Containers run on ECS Fargate behind an Application Load Balancer with per-service autoscaling.
- A WAF sits in front with global rate rules; ALB access logs are retained.
- GuardDuty and CloudTrail are enabled with alarms routed to a notification topic.
- A wildcard certificate covers tenant subdomains, so adding an institution needs no certificate change.
Cost shape
The database is the largest infrastructure line by a wide margin, which makes its minimum capacity the highest-leverage cost setting. Right-sizing tasks and removing unused components — an idle read replica, an unused connection proxy — were the other meaningful reductions.