← Back to work

An AWS stack built to survive its own failures.

A production container-hosting architecture (ECR through EC2, auto scaling, load balancing, and DNS) provisioned entirely with Terraform and deployed automatically through Bitbucket Pipelines. Releases cost nothing; instance failures fix themselves.

Context

Freelance client, live production workload

Stack

AWS · Terraform · Bitbucket Pipelines · Docker

Year

2023 - 2024

ECR EC2 Auto Scaling Group Application Load Balancer Route53

The mission

No ops team, no downtime budget

The client ran containerized workloads that needed to survive instance failures, absorb traffic spikes, and take new versions without downtime, with no dedicated ops team to babysit any of it.

The answer was a fully codified stack: Docker images flow from ECR onto EC2 instances managed by an Auto Scaling Group, fronted by an Application Load Balancer, with DNS in Route53. Every resource lives in Terraform; every deploy starts with a git push.

What I built

The work

Challenges

Problems along the way

Deploys dropped requests

Replacing instances naively cut off in-flight requests during every release.

Fixed: ALB connection draining plus ASG instance refresh gated on health checks, so new instances must pass before old ones terminate. Deploys became genuinely zero-downtime.

Environments kept drifting

Manually-created dev and prod diverged constantly, producing "works in dev" failures.

Fixed: one set of Terraform modules with per-environment variable files over remote state, so identical infrastructure is stamped out per environment, changed only through pull requests.

Auto scaling thrashed

Inherited scaling policies scaled up and down repeatedly under perfectly steady load.

Fixed: re-tuned CloudWatch alarms with proper cooldowns and target-tracking policies based on real traffic patterns, giving a stable fleet and fewer wasted instance-hours.

Outcome

Zero

downtime deployments after rollout

100%

of infrastructure in Terraform

Minutes

from push to production

24/7

self-healing via health checks

← Back to work Next: Canary deployments on AKS