Case study — 09
Backup-forge.
Backups for a database-per-tenant setup, where the list of databases changes every time a customer signs up.
- Role
- Open source · author
- Type
- Open source
- Year
- 2026
- Stack
- AWS ECS · S3 · Docker · MongoDB
01
The problem
With a database per tenant, a backup script that lists databases by name is out of date as soon as a new tenant arrives. Backups have to find every tenant database on their own, and a failure on one must never pass silently.
02
How it works
An EventBridge schedule starts an ECS task. The container lists every non-system database, runs gzip-compressed mongodump jobs in parallel (two at a time by default), retries each database up to three times, and uploads the dumps to S3 under a dated folder, with the run's log beside them.
03
Failing loudly
Any database that still fails after its retries is reported, and the task exits non-zero, so the failure shows up in ECS instead of hiding in a log nobody reads.
04
How it was built
A shell script packaged as a Docker image with no host dependencies, pushed to ECR. Credentials come from ECS task secrets, and the task role only needs permission to write to the backup bucket.