Lab : Conception d'Architecture HA
Objectif du Lab
Dans ce lab, vous allez concevoir une architecture hautement disponible pour une application web. Vous analyserez les exigences, identifierez les SPOF, et proposerez une solution robuste.
Partie 1 : Scénario
Contexte
ShopOnline est une plateforme e-commerce qui subit des pertes financières à chaque minute d'indisponibilité. La direction demande une architecture avec 99.9% de disponibilité.
Exigences
┌─────────────────────────────────────────────────────────────┐
│ EXIGENCES SHOPONLINE │
├─────────────────────────────────────────────────────────────┤
│ │
│ DISPONIBILITÉ │
│ • 99.9% uptime (max 8.76h downtime/an) │
│ • Failover automatique < 2 minutes │
│ • Zéro perte de données │
│ │
│ PERFORMANCE │
│ • Temps de réponse < 500ms │
│ • Support de 10,000 utilisateurs simultanés │
│ • Pics de charge x3 pendant les soldes │
│ │
│ SÉCURITÉ │
│ • HTTPS obligatoire │
│ • Base de données non exposée à Internet │
│ • Conformité PCI-DSS (paiement) │
│ │
│ BUDGET │
│ • Maximum $2,000/mois │
│ │
└─────────────────────────────────────────────────────────────┘
Architecture Actuelle (à améliorer)
┌─────────────────────────────────────────────────────────────┐
│ ARCHITECTURE ACTUELLE │
├─────────────────────────────────────────────────────────────┤
│ │
│ Internet │
│ │ │
│ ▼ │
│ ┌───────────────────────────────────────────────────────┐ │
│ │ VPC │ │
│ │ │ │
│ │ ┌──────────────────────────────────────────────┐ │ │
│ │ │ Subnet Public (AZ-a) │ │ │
│ │ │ │ │ │
│ │ │ ┌─────────────────────────┐ │ │ │
│ │ │ │ EC2 Instance │ │ │ │
│ │ │ │ (Web + App + API) │ │ │ │
│ │ │ │ t3.large │ │ │ │
│ │ │ │ IP: 52.x.x.x │ │ │ │
│ │ │ └───────────┬─────────────┘ │ │ │
│ │ │ │ │ │ │
│ │ └────────────────────┼──────────────────────────┘ │ │
│ │ │ │ │
│ │ ┌────────────────────┼──────────────────────────┐ │ │
│ │ │ Subnet Privé (AZ-a) │ │ │
│ │ │ │ │ │ │
│ │ │ ┌───────────▼─────────────┐ │ │ │
│ │ │ │ RDS │ │ │ │
│ │ │ │ MySQL 5.7 │ │ │ │
│ │ │ │ Single-AZ │ │ │ │
│ │ │ └─────────────────────────┘ │ │ │
│ │ │ │ │ │
│ │ └───────────────────────────────────────────────┘ │ │
│ │ │ │
│ └───────────────────────────────────────────────────────┘ │
│ │
└─────────────────────────────────────────────────────────────┘
Partie 2 : Analyse des SPOF
Exercice 2.1 : Identifier les SPOF
Analysez l'architecture actuelle et listez tous les points de défaillance unique :
| # | Composant | Type de SPOF | Impact si panne |
|---|---|---|---|
| 1 | ? | ? | ? |
| 2 | ? | ? | ? |
| 3 | ? | ? | ? |
| 4 | ? | ? | ? |
💡 Solution
| # | Composant | Type de SPOF | Impact si panne |
|---|---|---|---|
| 1 | EC2 unique | Compute | Site complètement down |
| 2 | RDS Single-AZ | Database | Perte de données possible |
| 3 | Une seule AZ | Infrastructure | Tout down si AZ tombe |
| 4 | IP publique sur EC2 | Accès | Pas de failover possible |
| 5 | Pas de LB | Distribution | Impossible de scaler |
Exercice 2.2 : Calculer la Disponibilité Actuelle
Si chaque composant a 99% de disponibilité individuelle, quelle est la disponibilité totale ?
Architecture en série : Dispo = Dispo_EC2 × Dispo_RDS × Dispo_AZ
💡 Solution
Dispo = 0.99 × 0.99 × 0.99 = 0.970 = 97%
Downtime annuel = 3% × 365 jours = 10.95 jours
C'est LOIN du 99.9% requis (8.76 heures) !
Partie 3 : Conception de la Solution
Exercice 3.1 : Dessiner l'Architecture Cible
Concevez une architecture qui atteint 99.9% de disponibilité.
Composants à inclure :
- Application Load Balancer
- Instances EC2 Multi-AZ
- RDS Multi-AZ
- Auto Scaling Group
Template à compléter :
┌─────────────────────────────────────────────────────────────────────────┐
│ VOTRE ARCHITECTURE │
├─────────────────────────────────────────────────────────────────────────┤
│ │
│ Internet │
│ │ │
│ [Dessinez ici] │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
└─────────────────────────────────────────────────────────────────────────┘
💡 Solution Architecture
┌─────────────────────────────────────────────────────────────────────────┐
│ ARCHITECTURE HA SHOPONLINE │
├─────────────────────────────────────────────────────────────────────────┤
│ │
│ Internet │
│ │ │
│ ┌──────▼──────┐ │
│ │ IGW │ │
│ └──────┬──────┘ │
│ │ │
│ ┌──────────────────────────────┼──────────────────────────────┐ │
│ │ VPC │ (10.0.0.0/16) │ │
│ │ │ │ │
│ │ ┌──────────────────────────┴────────────────────────────┐ │ │
│ │ │ SUBNETS PUBLICS │ │ │
│ │ │ │ │ │
│ │ │ ┌─────────────────┐ ┌─────────────────┐ │ │ │
│ │ │ │ Public AZ-a │ │ Public AZ-b │ │ │ │
│ │ │ │ 10.0.1.0/24 │ │ 10.0.2.0/24 │ │ │ │
│ │ │ │ │ │ │ │ │ │
│ │ │ │ ┌───────────┐ │ │ ┌───────────┐ │ │ │ │
│ │ │ │ │ ALB │◄─┼────────┼──│ ALB │ │ │ │ │
│ │ │ │ │ node │ │ │ │ node │ │ │ │ │
│ │ │ │ └─────┬─────┘ │ │ └─────┬─────┘ │ │ │ │
│ │ │ └────────┼────────┘ └────────┼────────┘ │ │ │
│ │ │ │ │ │ │ │
│ │ └───────────┼──────────────────────────┼─────────────────┘ │ │
│ │ │ │ │ │
│ │ ┌───────────┼──────────────────────────┼─────────────────┐ │ │
│ │ │ │ SUBNETS PRIVÉS (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 │ │ │ │ │
│ │ │ │ └─────┬─────┘ │ │ └─────┬─────┘ │ │ │ │
│ │ │ └────────┼────────┘ └────────┼────────┘ │ │ │
│ │ │ │ │ │ │ │
│ │ └───────────┼──────────────────────────┼─────────────────┘ │ │
│ │ │ │ │ │
│ │ ┌───────────┼──────────────────────────┼─────────────────┐ │ │
│ │ │ │ SUBNETS PRIVÉS (DB) │ │ │ │
│ │ │ │ │ │ │ │
│ │ │ ┌────────▼────────┐ ┌────────▼────────┐ │ │ │
│ │ │ │ DB AZ-a │ │ DB AZ-b │ │ │ │
│ │ │ │ 10.0.21.0/24 │ │ 10.0.22.0/24 │ │ │ │
│ │ │ │ │ │ │ │ │ │
│ │ │ │ ┌───────────┐ │ │ ┌───────────┐ │ │ │ │
│ │ │ │ │ RDS │◄─┼────────┼──│ RDS │ │ │ │ │
│ │ │ │ │ Primary │ │ sync │ │ Standby │ │ │ │ │
│ │ │ │ └───────────┘ │ │ └───────────┘ │ │ │ │
│ │ │ └─────────────────┘ └─────────────────┘ │ │ │
│ │ │ │ │ │
│ │ └────────────────────────────────────────────────────────┘ │ │
│ │ │ │
│ └───────────────────────────────────────────────────────────────┘ │
│ │
└─────────────────────────────────────────────────────────────────────────┘
Exercice 3.2 : Tableau de Configuration
Complétez le tableau de configuration pour votre architecture :
| Composant | Configuration | Justification |
|---|---|---|
| ALB | ? | ? |
| EC2 | Type: ?, Nombre min: ?, max: ? | ? |
| RDS | Type: ?, Multi-AZ: ? | ? |
| ASG | Scaling policy: ? | ? |
💡 Solution
| Composant | Configuration | Justification |
|---|---|---|
| ALB | Internet-facing, 2 AZ | Distribution + HA |
| EC2 | t3.medium, min:2, max:6 | 2 pour HA, 6 pour pics |
| RDS | db.t3.medium, Multi-AZ: Oui | Failover auto + 0 data loss |
| ASG | Target Tracking CPU 70% | Scale auto selon charge |
Partie 4 : Estimation des Coûts
Exercice 4.1 : Calculer le Coût Mensuel
Estimez le coût mensuel de votre architecture :
| Service | Configuration | Coût/mois |
|---|---|---|
| ALB | 1 ALB + usage | ? |
| EC2 | 2-6 t3.medium | ? |
| RDS | db.t3.medium Multi-AZ | ? |
| NAT Gateway | 2 (HA) | ? |
| Data Transfer | Estimé | ? |
| TOTAL | ? |
💡 Solution Estimation
| Service | Configuration | Coût/mois |
|---|---|---|
| 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/mois |
✅ Dans le budget de $2,000/mois avec marge pour scaling
Partie 5 : Plan de Test HA
Exercice 5.1 : Scénarios de Test
Décrivez comment vous testeriez la haute disponibilité :
| Test | Action | Résultat Attendu |
|---|---|---|
| Failover EC2 | ? | ? |
| Failover RDS | ? | ? |
| Panne AZ | ? | ? |
💡 Solution
| Test | Action | Résultat Attendu |
|---|---|---|
| Failover EC2 | Terminer 1 instance | ASG lance nouvelle, ALB redirige |
| Failover RDS | Reboot with failover | Standby devient primary, < 2min |
| Panne AZ | Désactiver subnet AZ-a | Trafic 100% sur AZ-b |
| Scale Out | Générer charge | Nouvelles instances auto |
| Health Check | Stopper nginx | ALB retire instance unhealthy |
Livrable Final
Document à Produire
Créez un document "Architecture HA ShopOnline" contenant :
- Analyse de l'existant (SPOF identifiés)
- Schéma d'architecture cible (avec tous composants)
- Tableau de configuration (détaillé)
- Estimation des coûts
- Plan de test HA
- Calcul de disponibilité théorique
Critères d'Évaluation
| Critère | Points |
|---|---|
| SPOF correctement identifiés | /15 |
| Architecture cohérente et complète | /25 |
| Configuration justifiée | /20 |
| Coûts dans le budget | /15 |
| Plan de test pertinent | /15 |
| Qualité du document | /10 |
| Total | /100 |
Prochaine semaine : Auto Scaling