← Back to Projects
☁️

Highly Available Two-Tier Application on AWS

VPC · Application Load Balancer · Auto Scaling Groups · Multi-AZ RDS — zero-downtime failover architecture

PlatformAWS
ToolsVPC · ALB · ASG · EC2 · RDS Multi-AZ · IAM
TypeHigh Availability Architecture
InternshipThe CloudAdvisory Oy — Cohort 2

Architecture

What I Built

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.

Internet ↓ Application Load Balancer (ALB) — Distributes traffic across multiple EC2 instances — Health checks remove unhealthy instances automatically ↓ Auto Scaling Group (ASG) — Web/App Tier AZ-1a: EC2 Instance AZ-1b: EC2 Instance Private Subnet 10.0.1.0/24 Private Subnet 10.0.2.0/24 ↓ RDS MySQL — Multi-AZ Primary DB (AZ-1a) ←sync→ Standby DB (AZ-1b) — Automatic failover if primary goes down — No manual intervention required VPC: Custom — 10.0.0.0/16 Security Groups: Least-privilege per tier IAM Roles: EC2 instance profiles scoped to required permissions only
Multi-AZ
RDS Failover
Auto
Scaling on Demand
0
Single Points of Failure
PoLP
Principle of Least Privilege

Technical Deep Dive

Custom VPC Design

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.

Application Load Balancer (ALB)

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.

Auto Scaling Group (ASG)

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.

RDS Multi-AZ

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

What I Took Away

High Availability Is Designed, Not Hoped For

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.

Security Groups Are Your First Line of Defense

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.

IAM Least Privilege Applies to Instances Too

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.

AWS VPCALBAuto ScalingRDS Multi-AZEC2IAMSecurity GroupsHigh Availability
✦ Spiritual Reflection: Building redundancy into architecture mirrors the principle of preparation. As D&C 58:27 says, be anxiously engaged — don't wait for the server to fail before planning for it.
Read Full Article on Medium →