Project 03 ยท Home Lab

Break things on purpose, safely, and measure exactly how fast you recover.

Built withAWS CDK (TypeScript)
LevelIntermediate
Time to build1 day
Running cost~$25 / month while deployed

The problem

Every architecture diagram says “highly available”. Very few teams have actually proved it. Chaos engineering replaces hope with evidence: inject a realistic failure, observe, and fix what breaks before customers find it. The hard part is doing it safely, and that is what this project solves.

What you’ll build

  • A production-shaped web tier: ALB + multi-AZ Auto Scaling group with ELB health checks and target-tracking scaling
  • Four AWS Fault Injection Service experiments: terminate 50% of instances, 100% CPU stress, +400 ms network latency, and a full AZ network blackout
  • An automatic stop condition: if the 5xx error rate passes 20% for two minutes, every experiment halts
  • A CloudWatch dashboard for error rate, healthy hosts, p95 latency and request volume

Architecture

Internet โ”€โ–ถ ALB โ”€โ–ถ Auto Scaling group (2โ€“4 instances, 2 AZs, ELB health checks)
                     โ–ฒ
     FIS experiments โ”‚  terminate 50% ยท CPU stress ยท +400ms latency ยท AZ network blackout
                     โ”‚
CloudWatch alarm (5xx rate > 20% for 2 min) โ”€โ”€โ–ถ STOPS every experiment + SNS alert
Dashboard: error rate ยท healthy hosts ยท p95 latency ยท requests

AWS services used

AWS FISEC2 Auto ScalingApplication Load BalancerSystems ManagerCloudWatchSNS

How it works

  1. HypothesizeWrite down what should happen, e.g. “losing half the fleet causes <1% errors and recovers in under 3 minutes”.
  2. InjectStart an FIS experiment from the CLI. FIS uses SSM documents for CPU and latency faults and native actions for termination and network disruption.
  3. ObserveWatch the dashboard. Record time-to-detect, time-to-recover and peak error rate.
  4. ImproveTune health-check thresholds, deregistration delay or minimum capacity, then run again until the hypothesis holds.

Key design decisions

  • The stop-condition alarm is non-negotiable. It is what makes chaos safe to run during business hours.
  • Experiments target instances by tag, so nothing outside the lab can be hit by accident.
  • Public subnets with ALB-only security groups keep the lab cheap (no NAT gateway) without exposing instances.

Deploy it

npm install
npx cdk deploy -c alertEmail=you@example.com

Full prerequisites, parameters and clean-up steps are in the project README on the code page.

See it work

Run the AzBlackout experiment while a load loop hits the app. Watch the healthy-host graph drop and recover while the error rate stays under the stop threshold.

Skills this demonstrates

Resilience engineeringFailure-mode analysisObservabilityIncident metrics (RTO, error budgets)

Get the code

Every file needed to build this project, written as a deployable AWS CDK app and validated with the CloudFormation schema.


Leave a Reply

Your email address will not be published. Required fields are marked *