Lab: Designing HA Architecture
Lab Objective
In this lab, you will design a highly available architecture for a web application. You will analyze the requirements, identify the SPOFs, and propose a robust solution.
Part 1: Scenario
Context
ShopOnline is an e-commerce platform that suffers financial losses for every minute of downtime. Management requires an architecture with 99.9% availability.
Requirements
┌─────────────────────────────────────────────────────────────┐
│ SHOPONLINE REQUIREMENTS │
├─────────────────────────────────────────────────────────────┤
│ │
│ AVAILABILITY │
│ • 99.9% uptime (max 8.76h downtime/year) │
│ • Automatic failover < 2 minutes │
│ • Zero data loss │
│ │
│ PERFORMANCE │
│ • Response time < 500ms │
│ • Support for 10,000 concurrent users │
│ • Load peaks x3 during sales │
│ │
│ SECURITY │
│ • HTTPS mandatory │
│ • Database not exposed to the Internet │
│ • PCI-DSS compliance (payment) │
│ │
│ BUDGET │
│ • Maximum $2,000/month │
│ │
└─────────────────────────────────────────────────────────────┘
Current Architecture (to improve)
┌─────────────────────────────────────────────────────────────┐
│ CURRENT ARCHITECTURE │
├─────────────────────────────────────────────────────────────┤
│ │
│ Internet │
│ │ │
│ ▼ │
│ ┌───────────────────────────────────────────────────────┐ │
│ │ VPC │ │
│ │ │ │
│ │ ┌──────────────────────────────────────────────┐ │ │
│ │ │ Public Subnet (AZ-a) │ │ │
│ │ │ │ │ │
│ │ │ ┌─────────────────────────┐ │ │ │
│ │ │ │ EC2 Instance │ │ │ │
│ │ │ │ (Web + App + API) │ │ │ │
│ │ │ │ t3.large │ │ │ │
│ │ │ │ IP: 52.x.x.x │ │ │ │
│ │ │ └───────────┬─────────────┘ │ │ │
│ │ │ │ │ │ │
│ │ └────────────────────┼──────────────────────────┘ │ │
│ │ │ │ │
│ │ ┌────────────────────┼──────────────────────────┐ │ │
│ │ │ Private Subnet (AZ-a) │ │ │
│ │ │ │ │ │ │
│ │ │ ┌───────────▼─────────────┐ │ │ │
│ │ │ │ RDS │ │ │ │
│ │ │ │ MySQL 5.7 │ │ │ │
│ │ │ │ Single-AZ │ │ │ │
│ │ │ └─────────────────────────┘ │ │ │
│ │ │ │ │ │
│ │ └───────────────────────────────────────────────┘ │ │
│ │ │ │
│ └───────────────────────────────────────────────────────┘ │
│ │
└─────────────────────────────────────────────────────────────┘
Part 2: SPOF Analysis
Exercise 2.1: Identify the SPOFs
Analyze the current architecture and list all single points of failure:
| # | Component | Type of SPOF | Impact if failure |
|---|---|---|---|
| 1 | ? | ? | ? |
| 2 | ? | ? | ? |
| 3 | ? | ? | ? |
| 4 | ? | ? | ? |
💡 Solution
| # | Component | Type of SPOF | Impact if failure |
|---|---|---|---|
| 1 | Single EC2 | Compute | Site completely down |
| 2 | RDS Single-AZ | Database | Possible data loss |
| 3 | Single AZ | Infrastructure | Everything down if AZ fails |
| 4 | Public IP on EC2 | Access | No failover possible |
| 5 | No LB | Distribution | Cannot scale |
Exercise 2.2: Calculate Current Availability
If each component has 99% individual availability, what is the total availability?
Series architecture: Availability = Availability_EC2 × Availability_RDS × Availability_AZ
💡 Solution
Availability = 0.99 × 0.99 × 0.99 = 0.970 = 97%
Annual downtime = 3% × 365 days = 10.95 days
This is FAR from the required 99.9% (8.76 hours)!
Part 3: Solution Design
Exercise 3.1: Draw the Target Architecture
Design an architecture that achieves 99.9% availability.
Components to include:
- Application Load Balancer
- Multi-AZ EC2 Instances
- Multi-AZ RDS
- Auto Scaling Group
Template to complete:
┌─────────────────────────────────────────────────────────────────────────┐
│ YOUR ARCHITECTURE │
├─────────────────────────────────────────────────────────────────────────┤
│ │
│ Internet │
│ │ │
│ [Draw here] │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
└─────────────────────────────────────────────────────────────────────────┘
💡 Solution Architecture
┌─────────────────────────────────────────────────────────────────────────┐
│ SHOPONLINE HA ARCHITECTURE │
├─────────────────────────────────────────────────────────────────────────┤
│ │
│ Internet │
│ │ │
│ ┌──────▼──────┐ │
│ │ IGW │ │
│ └──────┬──────┘ │
│ │ │
│ ┌──────────────────────────────┼──────────────────────────────┐ │
│ │ VPC │ (10.0.0.0/16) │ │
│ │ │ │ │
│ │ ┌──────────────────────────┴────────────────────────────┐ │ │
│ │ │ PUBLIC SUBNETS │ │ │
│ │ │ │ │ │
│ │ │ ┌─────────────────┐ ┌─────────────────┐ │ │ │
│ │ │ │ Public AZ-a │ │ Public AZ-b │ │ │ │
│ │ │ │ 10.0.1.0/24 │ │ 10.0.2.0/24 │ │ │ │
│ │ │ │ │ │ │ │ │ │
│ │ │ │ ┌───────────┐ │ │ ┌───────────┐ │ │ │ │
│ │ │ │ │ ALB │◄─┼────────┼──│ ALB │ │ │ │ │
│ │ │ │ │ node │ │ │ │ node │ │ │ │ │
│ │ │ │ └─────┬─────┘ │ │ └─────┬─────┘ │ │ │ │
│ │ │ └────────┼────────┘ └────────┼────────┘ │ │ │
│ │ │ │ │ │ │ │
│ │ └───────────┼──────────────────────────┼─────────────────┘ │ │
│ │ │ │ │ │
│ │ ┌───────────┼──────────────────────────┼─────────────────┐ │ │
│ │ │ │ PRIVATE SUBNETS (App) │ │ │ │
│ │ │ │ │ │ │ │
│ │ │ ┌────────▼────────┐ ┌────────▼────────┐ │ │ │
│ │ │ │ Private AZ-a │ │ Private AZ-b │ │ │ │
│ │ │ │ 10.0.11.0/24 │ │ 10.0.12.0/24 │ │ │ │
│ │ │ │ │ │ │ │ │ │
│ │ │ │ ┌───────────┐ │ │ ┌───────────┐ │ │ │ │
│ │ │ │ │ EC2 (ASG) │ │ │ │ EC2 (ASG) │ │ │ │ │
│ │ │ │ │ min:2 │ │ │ │ max:6 │ │ │ │ │
│ │ │ │ └─────┬─────┘ │ │ └─────┬─────┘ │ │ │ │
│ │ │ └────────┼────────┘ └────────┼────────┘ │ │ │
│ │ │ │ │ │ │ │
│ │ └───────────┼──────────────────────────┼─────────────────┘ │ │
│ │ │ │ │ │
│ │ ┌───────────┼──────────────────────────┼─────────────────┐ │ │
│ │ │ │ PRIVATE SUBNETS (DB) │ │ │ │
│ │ │ │ │ │ │ │
│ │ │ ┌────────▼────────┐ ┌────────▼────────┐ │ │ │
│ │ │ │ DB AZ-a │ │ DB AZ-b │ │ │ │
│ │ │ │ 10.0.21.0/24 │ │ 10.0.22.0/24 │ │ │ │
│ │ │ │ │ │ │ │ │ │
│ │ │ │ ┌───────────┐ │ │ ┌───────────┐ │ │ │ │
│ │ │ │ │ RDS │◄─┼────────┼──│ RDS │ │ │ │ │
│ │ │ │ │ Primary │ │ sync │ │ Standby │ │ │ │ │
│ │ │ │ └───────────┘ │ │ └───────────┘ │ │ │ │
│ │ │ └─────────────────┘ └─────────────────┘ │ │ │
│ │ │ │ │ │
│ │ └────────────────────────────────────────────────────────┘ │ │
│ │ │ │
│ └───────────────────────────────────────────────────────────────┘ │
│ │
└─────────────────────────────────────────────────────────────────────────┘
Exercise 3.2: Configuration Table
Complete the configuration table for your architecture:
| Component | Configuration | Justification |
|---|---|---|
| ALB | ? | ? |
| EC2 | Type: ?, Min number: ?, Max: ? | ? |
| RDS | Type: ?, Multi-AZ: ? | ? |
| ASG | Scaling policy: ? | ? |
💡 Solution
| Component | Configuration | Justification |
|---|---|---|
| ALB | Internet-facing, 2 AZ | Distribution + HA |
| EC2 | t3.medium, min:2, max:6 | 2 for HA, 6 for peaks |
| RDS | db.t3.medium, Multi-AZ: Yes | Auto failover + 0 data loss |
| ASG | Target Tracking CPU 70% | Auto scale based on load |
Part 4: Cost Estimation
Exercise 4.1: Calculate Monthly Cost
Estimate the monthly cost of your architecture:
| Service | Configuration | Cost/month |
|---|---|---|
| ALB | 1 ALB + usage | ? |
| EC2 | 2-6 t3.medium | ? |
| RDS | db.t3.medium Multi-AZ | ? |
| NAT Gateway | 2 (HA) | ? |
| Data Transfer | Estimated | ? |
| TOTAL | ? |
💡 Solution Estimation
| Service | Configuration | Cost/month |
|---|---|---|
| ALB | 1 ALB + usage | ~$25 |
| EC2 | 2 t3.medium (min) | ~$60 |
| RDS | db.t3.medium Multi-AZ | ~$100 |
| NAT Gateway | 2 + data | ~$70 |
| EBS | 100GB gp3 | ~$20 |
| Data Transfer | ~100GB | ~$10 |
| TOTAL | ~$285/month |
✅ Within the $2,000/month budget with room for scaling
Part 5: HA Test Plan
Exercise 5.1: Test Scenarios
Describe how you would test high availability:
| Test | Action | Expected Result |
|---|---|---|
| EC2 Failover | ? | ? |
| RDS Failover | ? | ? |
| AZ Failure | ? | ? |
💡 Solution
| Test | Action | Expected Result |
|---|---|---|
| EC2 Failover | Terminate 1 instance | ASG launches new one, ALB redirects |
| RDS Failover | Reboot with failover | Standby becomes primary, < 2min |
| AZ Failure | Disable AZ-a subnet | 100% traffic on AZ-b |
| Scale Out | Generate load | New instances auto |
| Health Check | Stop nginx | ALB removes unhealthy instance |
Final Deliverable
Document to Produce
Create a "ShopOnline HA Architecture" document containing:
- Existing Analysis (Identified SPOFs)
- Target Architecture Diagram (with all components)
- Configuration Table (detailed)
- Cost Estimation
- HA Test Plan
- Theoretical Availability Calculation
Evaluation Criteria
| Criterion | Points |
|---|---|
| Correctly identified SPOFs | /15 |
| Coherent and complete architecture | /25 |
| Justified configuration | /20 |
| Costs within budget | /15 |
| Relevant test plan | /15 |
| Document quality | /10 |
| Total | /100 |
Next week: Auto Scaling