VPC · Application Load Balancer · Auto Scaling Groups · Multi-AZ RDS — zero-downtime failover architecture
Architecture
A highly available two-tier application built on AWS following production best practices. The architecture ensures zero-downtime failover across availability zones by distributing load, scaling automatically, and replicating the database across multiple AZs.
Key Components
Built a custom VPC (10.0.0.0/16) with public and private subnets across two availability zones. Public subnets host the load balancer; private subnets host EC2 instances and the database — following the principle that only what must be public should be public.
Configured ALB with target groups, health check paths, and listener rules. The ALB continuously checks instance health and automatically stops routing traffic to any instance that fails its health check — users never experience the failure.
Defined scaling policies based on CPU utilization. When load increases, ASG launches new instances automatically. When load decreases, it terminates excess instances. The application scales to demand without human intervention.
MySQL RDS with Multi-AZ enabled. AWS maintains a synchronous standby replica in a separate AZ. If the primary database fails, RDS automatically promotes the standby — typical failover time is 60–120 seconds with no application code changes required.
Lessons Learned
Single-instance deployments rely on hoping nothing fails. Multi-AZ, ALB, and ASG together mean the system continues working even when individual components fail — because failure was planned for from the start.
Each tier's security group only allows traffic from the tier directly above it. The database security group only accepts connections from the application tier — never from the internet, never from the load balancer.
EC2 instances accessed S3 and other AWS services through IAM instance profiles scoped to only the permissions required. No hardcoded credentials anywhere in the application.