How urbanworkteam/infra works
Farmily Infrastructure provisions the application’s AWS runtime and also contains a multi-region disaster-recovery system. The primary operational workflow is health-check failure detection, failover orchestration and approval, database fencing and promotion, then verification and retrospective reporting. Terraform modules represent the application platform; the DR Lambda handlers implement distinct control and investigation stages. Several DR connections are documented in handler comments, but the orchestration definition and most Terraform wiring were not excerpted, so unsampled relationships are omitted.
Main entry points: stepfunctions.tf Failover Workflow · dev/main.tf Dev Environment · prod/main.tf Prod Environment · handler.py Slack Callback
Components 32
AWS Platform
- Dev Environment
Desktop/VPC/environments/dev/main.tf - Prod Environment
Desktop/VPC/environments/prod/main.tf - VPC Network
Desktop/VPC/modules/vpc/main.tf - Security Groups
Desktop/VPC/modules/sg/main.tf - CloudWatch Alerts
Desktop/VPC/modules/cloudwatch/main.tf
Application Runtime
- ECS Fargate
Desktop/VPC/modules/ecs/main.tf - PostgreSQL RDS
Desktop/VPC/modules/rds/main.tf - Redis Cache
Desktop/VPC/modules/elasticache/main.tf - Static File Store
Desktop/VPC/modules/s3/main.tf - CloudFront CDN
Desktop/VPC/modules/cloudfront/main.tf
DR Control
- Health Canary
Desktop/VPC/lambdas/detect_canary/handler.py - Failover Workflow
Desktop/VPC/environments/dr-brain/stepfunctions.tf
DR Workers
- Replica Diagnosis
Desktop/VPC/lambdas/diagnose/handler.py - Failover Advice
Desktop/VPC/lambdas/advisor/handler.py - Primary Fencing
Desktop/VPC/lambdas/fence/handler.py - Replica Promotion
Desktop/VPC/lambdas/promote/handler.py - Coordinator Update
Desktop/VPC/lambdas/flip_coordinator/handler.py - DB Verification
Desktop/VPC/lambdas/verify/handler.py - Failover Audit
Desktop/VPC/lambdas/audit_agent/handler.py - Retrospective Report
Desktop/VPC/lambdas/retrospective/handler.py
Operator Tools
- Slack Approval
Desktop/VPC/lambdas/slack_notify/handler.py - Slack Callback
Desktop/VPC/lambdas/slack_callback/handler.py - Traffic Pin Control
Desktop/VPC/lambdas/traffic_pin/handler.py - Manual Unfence
Desktop/VPC/lambdas/unfence/handler.py
Other components
- Operator
- AWS RDS
- Step Functions
- Slack
- DynamoDB Coordinator
- SNS Alerts
- Bedrock
- AWS S3
Connections 48
- Operator → Dev Environment: provisions
README.md - Operator → Prod Environment: provisions
README.md - Dev Environment → VPC Network: configures
README.md - Dev Environment → Security Groups: configures
README.md - Dev Environment → ECS Fargate: configures
README.md - Dev Environment → PostgreSQL RDS: configures
README.md - Dev Environment → Redis Cache: configures
README.md - Dev Environment → Static File Store: configures
README.md - Dev Environment → CloudFront CDN: configures
README.md - Dev Environment → CloudWatch Alerts: configures
README.md - Prod Environment → VPC Network: configures
README.md - Prod Environment → Security Groups: configures
README.md - Prod Environment → ECS Fargate: configures
README.md - Prod Environment → PostgreSQL RDS: configures
README.md - Prod Environment → Redis Cache: configures
README.md - Prod Environment → Static File Store: configures
README.md - Prod Environment → CloudFront CDN: configures
README.md - Prod Environment → CloudWatch Alerts: configures
README.md - ECS Fargate → PostgreSQL RDS: uses
- ECS Fargate → Redis Cache: uses
- CloudFront CDN → Static File Store: serves
README.md - CloudWatch Alerts → SNS Alerts: alerts
README.md - Health Canary → Step Functions: starts execution
Desktop/VPC/lambdas/detect_canary/handler.py - Health Canary → DynamoDB Coordinator: updates health
Desktop/VPC/lambdas/detect_canary/handler.py - Health Canary → SNS Alerts: publishes alert
Desktop/VPC/lambdas/detect_canary/handler.py - Failover Workflow → Slack Approval: requests approval
Desktop/VPC/lambdas/slack_notify/handler.py - Slack Approval → Slack: posts card
Desktop/VPC/lambdas/slack_notify/handler.py - Slack → Slack Callback: sends action
Desktop/VPC/lambdas/slack_callback/handler.py - Slack Callback → Step Functions: resumes task
Desktop/VPC/lambdas/slack_callback/handler.py - Slack Callback → Traffic Pin Control: invokes control
Desktop/VPC/lambdas/slack_callback/handler.py - Slack Callback → Manual Unfence: invokes recovery
Desktop/VPC/lambdas/slack_callback/handler.py - Failover Workflow → Replica Diagnosis: runs diagnosis
- Failover Workflow → Failover Advice: requests advice
- Failover Workflow → Primary Fencing: runs fence
- Failover Workflow → Replica Promotion: runs promotion
- Failover Workflow → Coordinator Update: updates primary
- Failover Workflow → DB Verification: runs baseline
Desktop/VPC/lambdas/verify/handler.py - Failover Workflow → Failover Audit: runs audit
- Failover Workflow → Retrospective Report: creates report
Desktop/VPC/lambdas/retrospective/handler.py - Replica Diagnosis → AWS RDS: reads replica
Desktop/VPC/lambdas/diagnose/handler.py - Failover Advice → Bedrock: requests analysis
Desktop/VPC/lambdas/advisor/handler.py - Primary Fencing → AWS RDS: replaces groups
Desktop/VPC/lambdas/fence/handler.py - Primary Fencing → DynamoDB Coordinator: records fence
Desktop/VPC/lambdas/fence/handler.py - Replica Promotion → AWS RDS: promotes replica
- Coordinator Update → DynamoDB Coordinator: updates coordinator
Desktop/VPC/lambdas/flip_coordinator/handler.py - DB Verification → AWS RDS: checks database
Desktop/VPC/lambdas/verify/handler.py - Failover Audit → DB Verification: invokes checks
Desktop/VPC/lambdas/audit_agent/handler.py - Failover Audit → Bedrock: uses tool loop
Desktop/VPC/lambdas/audit_agent/handler.py