Skip to main content

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:

#ComponentType of SPOFImpact if failure
1???
2???
3???
4???
💡 Solution
#ComponentType of SPOFImpact if failure
1Single EC2ComputeSite completely down
2RDS Single-AZDatabasePossible data loss
3Single AZInfrastructureEverything down if AZ fails
4Public IP on EC2AccessNo failover possible
5No LBDistributionCannot 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:

ComponentConfigurationJustification
ALB??
EC2Type: ?, Min number: ?, Max: ??
RDSType: ?, Multi-AZ: ??
ASGScaling policy: ??
💡 Solution
ComponentConfigurationJustification
ALBInternet-facing, 2 AZDistribution + HA
EC2t3.medium, min:2, max:62 for HA, 6 for peaks
RDSdb.t3.medium, Multi-AZ: YesAuto failover + 0 data loss
ASGTarget 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:

ServiceConfigurationCost/month
ALB1 ALB + usage?
EC22-6 t3.medium?
RDSdb.t3.medium Multi-AZ?
NAT Gateway2 (HA)?
Data TransferEstimated?
TOTAL?
💡 Solution Estimation
ServiceConfigurationCost/month
ALB1 ALB + usage~$25
EC22 t3.medium (min)~$60
RDSdb.t3.medium Multi-AZ~$100
NAT Gateway2 + data~$70
EBS100GB 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:

TestActionExpected Result
EC2 Failover??
RDS Failover??
AZ Failure??
💡 Solution
TestActionExpected Result
EC2 FailoverTerminate 1 instanceASG launches new one, ALB redirects
RDS FailoverReboot with failoverStandby becomes primary, < 2min
AZ FailureDisable AZ-a subnet100% traffic on AZ-b
Scale OutGenerate loadNew instances auto
Health CheckStop nginxALB removes unhealthy instance

Final Deliverable​

Document to Produce​

Create a "ShopOnline HA Architecture" document containing:

  1. Existing Analysis (Identified SPOFs)
  2. Target Architecture Diagram (with all components)
  3. Configuration Table (detailed)
  4. Cost Estimation
  5. HA Test Plan
  6. Theoretical Availability Calculation

Evaluation Criteria​

CriterionPoints
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