
Case study / CloudFordge
Building CloudFordge was the easy part. Keeping it running was the project.
CloudFordge is an exam platform for cloud certifications. This is how it runs on AWS, what happens when parts of it fail, and how I find out before a student does.
- awsAWS
Terraform
CloudFormation
ECS Fargate
RDS (MySQL)
Grafana
- 2Availability ZonesMulti-AZ, so one data centre is a failover, not an outage
- 6CloudWatch alarmsEach tied to a failure I have a plan for
- 73Resources as codeRebuilt or destroyed with one command
- 60%CPU scaling targetBetween one and three tasks, capped on purpose
The problem
Writing the code was never the hard part
These days, a platform like CloudFordge, with accounts, timed mock exams and a question bank, is quick to put together. With AI-assisted coding you can have it running in a short time, and I will not pretend otherwise. The code was not what made this project difficult.
The hard part is the thinking that code does not give you. Where should each piece live, and what happens when it fails? What should the system do when the database restarts halfway through a timed exam, a container runs out of memory, or a hundred students start a test at once? And once it is live, how do you keep it healthy week after week, with releases, patches and alarms, while real people depend on it?
Those questions are system design and operations, and a prompt does not answer them for you. So I treated CloudFordge as a reliability problem first. I wrote down the failures I expected, decided what the system should do about each one without a person stepping in, and then built the infrastructure to match. The rest of this page is that work: how it runs, how it fails safely, and how I keep it running.
Interactive
Watch a visit, a release, and what breaks
It plays on its own, one scenario after another: a visit, a release, an admin adding a course, a bad release, a database failure, a crashed task and a traffic spike. Click a tab to jump to one. The diagram is the real topology, simplified.
Follow one visit from the browser to the database and back
1. The browser asks Route 53
Before any request, the browser resolves cloudfordge.com. Route 53 hosts the DNS zone, and an alias record points the name at the load balancer.
Design
Decisions that keep it up
Two Availability Zones
The load balancer, the subnets and the database standby span two AZs, so the loss of one data centre is a failover, not an outage.
Private by default
Only the ALB is public. Tasks and the database sit in private subnets, and database subnets have no route to the internet. Security groups reference each other, so only the ALB can reach the app and only the app can reach MySQL.
Managed failover
Multi-AZ RDS replicates synchronously and flips the endpoint on failure. I chose it over a self-managed replica because recovery should not depend on someone being awake.
Safe releases
A push builds a new image in CodeBuild and stores it in ECR. ECS starts the new tasks before stopping the old ones, the ALB waits for health checks, and the circuit breaker rolls back a release that never turns healthy.
Self-healing tasks
ECS keeps the desired count, the ALB health check removes bad targets, and a deployment circuit breaker rolls back a release that never becomes healthy.
Scale on a signal
Target tracking on 60% CPU between one and three tasks. The cap is deliberate: it bounds the bill during a spike.
Secrets out of the code
Database credentials and the auth secret are generated and stored in Secrets Manager, then injected at start-up. Nothing sensitive is in the image, the repo or the state file's inputs.
Everything is code
The same stack exists as Terraform and as a CloudFormation template. I can destroy it and rebuild it from the repository, which is the only honest test of a runbook.
Operations
How I know before a student does
Six CloudWatch alarms publish to an SNS topic that emails me. Each one maps to a failure I have a plan for, and none of them exists just to make a dashboard look busy.
Dashboards
On the live site I watch four Grafana dashboards. They are built to be read in order: first what a student would feel, then the app, the database and the host that explain it. Click one to see it full size.
Infrastructure as code
The whole stack is a repository
The same architecture is written twice, as Terraform and as a single CloudFormation template, so the design does not depend on one tool. I deployed the Terraform version end to end: plan, apply, image build, database migration and a healthy service, then destroyed it and confirmed nothing was left behind.
The first version I built by hand in the Console, to understand each service. Rewriting it as code is what exposed the mistakes below.
Read the code on GitHub ↗Lessons
What went wrong on the way
The database port
The RDS security group allowed 3006 instead of 3306. The app waited forever. In code the port is a single value and the rule references the app's security group.
A grace period of zero
ECS killed tasks before the app finished booting. The service now allows 90 seconds before health checks count.
A secret that drifted
An IAM policy named a different secret than the real one. Now it references the resource itself, so the two cannot drift apart.
Bootstrap order
The service cannot start before an image exists and the schema is migrated, so it is created with zero tasks and scaled up afterwards.
Want infrastructure that fails gracefully?
I design, build and operate reliable platforms on AWS.
Get in touch


