Lab : Publication d'un Service Web
Objectif du Lab
Dans ce lab, vous allez concevoir et documenter le déploiement d'un service web complet sur AWS. Vous analyserez les différentes options d'architecture et produirez un plan de déploiement.
Ce lab est axé sur la conception et documentation. Vous utiliserez les commandes CLI pour simuler avec LocalStack si disponible.
Contexte
Vous êtes chargé de déployer l'application BlogPro, une plateforme de blogging pour entreprises.
Exigences Fonctionnelles
┌─────────────────────────────────────────────────────────────┐
│ EXIGENCES BLOGPRO │
├─────────────────────────────────────────────────────────────┤
│ │
│ APPLICATION │
│ • Site web accessible via HTTPS │
│ • API backend (Node.js ou Python) │
│ • Base de données MySQL │
│ • Stockage des images (S3) │
│ │
│ PERFORMANCE │
│ • Temps de réponse < 500ms │
│ • Support de 1000 utilisateurs simultanés │
│ │
│ DISPONIBILITÉ │
│ • 99.9% uptime (environ 8h downtime/an max) │
│ • Zéro downtime lors des déploiements │
│ │
│ SÉCURITÉ │
│ • Certificat SSL/TLS │
│ • Base de données non accessible depuis Internet │
│ • Conformité aux bonnes pratiques AWS │
│ │
│ BUDGET │
│ • Environ $200-300/mois │
│ │
└─────────────────────────────────────────────────────────────┘
Partie 1 : Conception de l'Architecture
Exercice 1.1 : Choix de l'Architecture
Analysez les trois options suivantes et choisissez la meilleure pour BlogPro :
Option A : Architecture Simple
Internet → IGW → EC2 (public) → RDS (private)
Option B : Architecture avec ALB
Internet → IGW → ALB → EC2 (private) → RDS (private)
Option C : Architecture Serverless
Internet → CloudFront → API Gateway → Lambda → RDS/DynamoDB
Votre analyse :
| Critère | Option A | Option B | Option C |
|---|---|---|---|
| Coût estimé | ? | ? | ? |
| Haute disponibilité | ? | ? | ? |
| Scalabilité | ? | ? | ? |
| Complexité | ? | ? | ? |
| Adapté à BlogPro ? | ? | ? | ? |
💡 Solution suggérée
| Critère | Option A | Option B | Option C |
|---|---|---|---|
| Coût estimé | ~$50/mois | ~$200/mois | Variable |
| Haute disponibilité | ❌ Non | ✅ Oui | ✅ Oui |
| Scalabilité | ❌ Limitée | ✅ Bonne | ✅✅ Excellente |
| Complexité | ⭐ Simple | ⭐⭐ Moyenne | ⭐⭐⭐ Complexe |
| Adapté à BlogPro ? | ❌ | ✅ | ❌ (over-engineering) |
Recommandation : Option B
- Répond aux exigences de HA et performance
- Coût dans le budget
- Complexité raisonnable pour l'équipe
Exercice 1.2 : Schéma d'Architecture
Dessinez l'architecture complète avec tous les composants :
Template :
┌─────────────────────────────────────────────────────────────────────────┐
│ ARCHITECTURE BLOGPRO │
├─────────────────────────────────────────────────────────────────────────┤
│ │
│ INTERNET │
│ │ │
│ [Votre schéma ici] │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
└─────────────────────────────────────────────────────────────────────────┘
💡 Schéma solution
┌─────────────────────────────────────────────────────────────────────────┐
│ ARCHITECTURE BLOGPRO │
├─────────────────────────────────────────────────────────────────────────┤
│ │
│ Users / Internet │
│ │ │
│ ▼ │
│ ┌─────────────────┐ │
│ │ Route 53 │ blog.example.com │
│ └────────┬────────┘ │
│ │ │
│ ┌────────▼────────┐ │
│ │ CloudFront │ CDN + SSL │
│ └────────┬────────┘ │
│ │ │
│ ┌─────────────────────────┼─────────────────────────────────┐ │
│ │ VPC │ (10.0.0.0/16) │ │
│ │ │ │ │
│ │ ┌──────────▼──────────┐ │ │
│ │ │ IGW │ │ │
│ │ └──────────┬──────────┘ │ │
│ │ │ │ │
│ │ ┌─────────────────────┼─────────────────────────┐ │ │
│ │ │ PUBLIC SUBNETS │ │ │ │
│ │ │ │ │ │ │
│ │ │ ┌─────────┐ ┌─────▼─────┐ ┌─────────┐ │ │ │
│ │ │ │ NAT GW │ │ ALB │ │ NAT GW │ │ │ │
│ │ │ │ 1a │ │ │ │ 1b │ │ │ │
│ │ │ └────┬────┘ └─────┬─────┘ └────┬────┘ │ │ │
│ │ └───────┼─────────────┼─────────────┼──────────┘ │ │
│ │ │ │ │ │ │
│ │ ┌───────┼─────────────┼─────────────┼──────────┐ │ │
│ │ │ PRIVATE SUBNETS │ │ │ │
│ │ │ │ ┌────┴────┐ │ │ │ │
│ │ │ ┌────────▼────┤ ├────▼────────┐ │ │ │
│ │ │ │ │ │ │ │ │ │
│ │ │ │ ┌───────┐ │ │ ┌───────┐ │ │ │ │
│ │ │ │ │ EC2 │ │ │ │ EC2 │ │ │ │ │
│ │ │ │ │ App 1 │ │ │ │ App 2 │ │ │ │ │
│ │ │ │ └───┬───┘ │ │ └───┬───┘ │ │ │ │
│ │ │ │ │ │ │ │ │ │ │ │
│ │ │ └──────┼──────┘ └──────┼──────┘ │ │ │
│ │ └─────────┼───────────────────────┼───────────┘ │ │
│ │ │ │ │ │
│ │ ┌─────────┼───────────────────────┼───────────┐ │ │
│ │ │ DB SUBNETS │ │ │ │
│ │ │ │ ┌──────────────────┘ │ │ │
│ │ │ │ │ │ │ │
│ │ │ ┌────▼────▼────┐ │ │ │
│ │ │ │ RDS │ │ │ │
│ │ │ │ Multi-AZ │ │ │ │
│ │ │ │ MySQL │ │ │ │
│ │ │ └──────────────┘ │ │ │
│ │ └─────────────────────────────────────────────┘ │ │
│ │ │ │
│ │ ┌─────────────────────────────────────────────┐ │ │
│ │ │ S3 Bucket │ │ │
│ │ │ (images/assets) │ │ │
│ │ └─────────────────────────────────────────────┘ │ │
│ │ │ │
│ └──────────────────────────────────────────────────────────┘ │
│ │
└────────────────────────────────────────────────────────────────────────┘
Partie 2 : Plan d'Adressage IP
Exercice 2.1 : Définir les CIDR
Complétez le plan d'adressage :
| Ressource | CIDR | IPs Utilisables | Usage |
|---|---|---|---|
| VPC | 10.0.0.0/16 | 65,531 | - |
| Public Subnet 1a | ? | ? | ALB, NAT |
| Public Subnet 1b | ? | ? | ALB, NAT |
| Private Subnet 1a | ? | ? | App servers |
| Private Subnet 1b | ? | ? | App servers |
| DB Subnet 1a | ? | ? | RDS |
| DB Subnet 1b | ? | ? | RDS |
💡 Solution
| Ressource | CIDR | IPs Utilisables | Usage |
|---|---|---|---|
| VPC | 10.0.0.0/16 | 65,531 | - |
| Public Subnet 1a | 10.0.1.0/24 | 251 | ALB, NAT |
| Public Subnet 1b | 10.0.2.0/24 | 251 | ALB, NAT |
| Private Subnet 1a | 10.0.11.0/24 | 251 | App servers |
| Private Subnet 1b | 10.0.12.0/24 | 251 | App servers |
| DB Subnet 1a | 10.0.21.0/24 | 251 | RDS |
| DB Subnet 1b | 10.0.22.0/24 | 251 | RDS |
Partie 3 : Configuration de Sécurité
Exercice 3.1 : Security Groups
Définissez les règles pour chaque Security Group :
sg-alb :
Inbound:
- Type: ?, Port: ?, Source: ?
- Type: ?, Port: ?, Source: ?
Outbound:
- Type: ?, Port: ?, Destination: ?
sg-app :
Inbound:
- Type: ?, Port: ?, Source: ?
- Type: ?, Port: ?, Source: ?
Outbound:
- Type: ?, Port: ?, Destination: ?
- Type: ?, Port: ?, Destination: ?
sg-db :
Inbound:
- Type: ?, Port: ?, Source: ?
Outbound:
- Type: ?, Port: ?, Destination: ?
💡 Solution
sg-alb :
Inbound:
- Type: HTTPS, Port: 443, Source: 0.0.0.0/0
- Type: HTTP, Port: 80, Source: 0.0.0.0/0 (redirect to HTTPS)
Outbound:
- Type: HTTP, Port: 80, Destination: sg-app
sg-app :
Inbound:
- Type: HTTP, Port: 80, Source: sg-alb
- Type: SSH, Port: 22, Source: sg-bastion (ou IP admin)
Outbound:
- Type: MySQL, Port: 3306, Destination: sg-db
- Type: HTTPS, Port: 443, Destination: 0.0.0.0/0 (APIs, updates)
sg-db :
Inbound:
- Type: MySQL, Port: 3306, Source: sg-app
Outbound:
- (Aucune règle explicite nécessaire - stateful)
Partie 4 : Plan de Validation
Exercice 4.1 : Tests End-to-End
Listez les tests à effectuer pour valider le déploiement :
| Test | Commande/Action | Résultat Attendu |
|---|---|---|
| DNS résolution | ? | ? |
| HTTPS accessible | ? | ? |
| Health check | ? | ? |
| Connexion DB | ? | ? |
| Failover AZ | ? | ? |
💡 Solution
| Test | Commande/Action | Résultat Attendu |
|---|---|---|
| DNS résolution | nslookup blog.example.com | Retourne IP ALB |
| HTTPS accessible | curl -I https://blog.example.com | HTTP 200 OK |
| Health check | curl https://blog.example.com/health | status: healthy |
| Connexion DB | Log application | Database connected |
| Failover AZ | Arrêter instance AZ-a | Site toujours accessible |
| Load balancing | Plusieurs requêtes | Réponses des 2 instances |
| SSL certificate | Browser check | Certificat valide |
Partie 5 : Documentation
Livrable Final
Produisez un document contenant :
-
Schéma d'architecture (avec tous les composants)
-
Tableau d'adressage IP
-
Matrice de Security Groups
-
Plan de tests de validation
-
Estimation des coûts :
| Service | Configuration | Coût Mensuel |
|---|---|---|
| EC2 (x2) | t3.medium | ~$60 |
| RDS | db.t3.small Multi-AZ | ~$50 |
| ALB | + data transfer | ~$30 |
| NAT Gateway (x2) | + data | ~$70 |
| Route 53 | 1 hosted zone | ~$1 |
| Total | ~$211/mois |
- Risques identifiés et mitigations
Critères d'Évaluation
| Critère | Points |
|---|---|
| Architecture correcte et complète | /25 |
| Plan d'adressage cohérent | /15 |
| Security Groups bien configurés | /20 |
| Tests de validation pertinents | /15 |
| Estimation coûts réaliste | /10 |
| Qualité de la documentation | /15 |
| Total | /100 |
Bonus : Script de Déploiement
Si vous avez accès à LocalStack, testez ces commandes :
#!/bin/bash
# deploy-blogpro.sh
ENDPOINT="--endpoint-url=http://localhost:4566"
# 1. Créer le VPC
VPC_ID=$(aws $ENDPOINT ec2 create-vpc \
--cidr-block 10.0.0.0/16 \
--query 'Vpc.VpcId' --output text)
echo "VPC créé: $VPC_ID"
# 2. Créer les subnets publics
SUBNET_PUB_1A=$(aws $ENDPOINT ec2 create-subnet \
--vpc-id $VPC_ID \
--cidr-block 10.0.1.0/24 \
--availability-zone us-east-1a \
--query 'Subnet.SubnetId' --output text)
echo "Subnet public 1a: $SUBNET_PUB_1A"
# ... continuer avec les autres ressources
Prochaine section : Tests et Validation