In this article, we explore a common interview question for DevOps and cloud engineering roles: How would you design a production-level architecture for 5 virtual machines (VMs) that require 24/7 uptime and disaster recovery (DR)?
This scenario tests your understanding of High Availability (HA) and Disaster Recovery (DR) principles. The goal is to ensure that even if an entire availability zone fails, the VMs remain running and accessible.
Key Components of the Architecture
-
Multi-Availability Zone (AZ) Deployment – Deploy the 5 VMs across at least two AZs within a region. This prevents a single zone failure from taking down all instances.
-
Load Balancer (e.g., AWS ALB or NLB) – Distribute traffic across healthy VMs in different AZs. The load balancer automatically reroutes traffic away from failed instances.
-
Auto Scaling Group – Configure an Auto Scaling Group to maintain the desired count of VMs across AZs. If a VM fails or an AZ becomes unavailable, Auto Scaling launches a new VM in a healthy AZ.
-
Application-Level Health Checks – Implement health checks at the application layer so the load balancer and auto scaling can detect actual application failures, not just instance-level issues.
-
Database (if used) – For stateful services, use a managed database with multi-AZ replication (e.g., Amazon RDS Multi-AZ). If using self-managed databases, replicate data across zones.
-
Disaster Recovery Strategy – For cross-region DR, replicate data regularly (e.g., using AWS Cross-Region Replication for S3, or database cross-region read replicas). In case of a regional failure, promote a standby region.
Step-by-Step Design for 5 VMs
-
Choose a region with at least 2 AZs (e.g., us-east-1 with us-east-1a and us-east-1b).
-
Create a Virtual Private Cloud (VPC) with public and private subnets across both AZs.
-
Launch 5 VMs in an Auto Scaling Group spread across the two AZs. For example, place 3 VMs in us-east-1a and 2 in us-east-1b.
-
Attach an Application Load Balancer in front of the Auto Scaling Group, configured with health checks on a specific path (e.g.,
/health). -
Configure scaling policies to maintain the desired count (5) and optionally scale based on metrics like CPU utilization.
-
For stateful data, use a managed database (e.g., RDS with Multi-AZ enabled) or replicate data asynchronously to a second region.
-
Set up cross-region disaster recovery using tools like AWS DMS (Database Migration Service) for continuous replication, and a secondary Auto Scaling Group in the DR region that is activated manually or via automation.
Example Architecture Diagram (Text-Based)
Region: us-east-1
├── VPC
│ ├── AZ us-east-1a
│ │ ├── Public Subnet (Load Balancer)
│ │ └── Private Subnet
│ │ ├── VM1
│ │ ├── VM2
│ │ └── VM3
│ └── AZ us-east-1b
│ ├── Public Subnet (Load Balancer)
│ └── Private Subnet
│ ├── VM4
│ └── VM5
└── Application Load Balancer (internet-facing)
└── Target Group (Auto Scaling Group)
└── Health Check: /health
DR Region: us-west-2 (standby)
├── VPC with similar architecture
└── Database cross-region replication enabled
Why This Design Works
- High Availability: VMs are distributed across multiple AZs; a single AZ failure leaves 2-3 VMs running. The load balancer ensures traffic is only routed to healthy instances.
- Disaster Recovery: If the entire primary region fails, you can fail over to the DR region by updating DNS (e.g., Route53) and activating the standby infrastructure.
Interview Tips
- Emphasize trade-offs between cost and availability. For 5 VMs, running 3+2 across two AZs is cost-effective. For stricter SLAs, consider 3+2+1 across three AZs.
- Mention automation with Infrastructure as Code (Terraform, CloudFormation) to make the architecture reproducible.
- Be prepared to discuss how you would handle stateful applications (e.g., using shared storage like EFS, or session replication).
By following this design, you demonstrate a solid grasp of production-level infrastructure that satisfies both high availability and disaster recovery requirements.