eadl:bloc4:fm4:td1

Différences

Ci-dessous, les différences entre deux révisions de la page.

Lien vers cette vue comparative

Les deux révisions précédentes Révision précédente
Prochaine révision
Révision précédente
eadl:bloc4:fm4:td1 [2026/04/14 20:37] – [1. Configuration du provider] jcheroneadl:bloc4:fm4:td1 [2026/04/14 23:02] (Version actuelle) – [Prérequis] jcheron
Ligne 14: Ligne 14:
   * Terraform installé   * Terraform installé
   * AWS CLI configuré   * AWS CLI configuré
-  * Une paire de clés SSH+  * Une paire de clés SSH générée sur votre machine
  
  
Ligne 27: Ligne 27:
  
 ===== 2. Déclaration de la variable SSH ===== ===== 2. Déclaration de la variable SSH =====
-<sxh hcl>+<sxh json>
 variable "public_key_path" { variable "public_key_path" {
   description = "Chemin vers la clé publique SSH"   description = "Chemin vers la clé publique SSH"
Ligne 36: Ligne 36:
  
 ===== 3. Création de la clé AWS ===== ===== 3. Création de la clé AWS =====
-<sxh hcl>+<sxh json>
 resource "aws_key_pair" "zerp_key" { resource "aws_key_pair" "zerp_key" {
   key_name   = "zerp-key"   key_name   = "zerp-key"
Ligne 45: Ligne 45:
  
 ===== 4. Security Group (SSH) ===== ===== 4. Security Group (SSH) =====
-<sxh hcl>+<sxh json>
 resource "aws_security_group" "zerp_sg" { resource "aws_security_group" "zerp_sg" {
   name = "zerp-sg"   name = "zerp-sg"
Ligne 65: Ligne 65:
  
 ===== 5. Création de l'instance EC2 ===== ===== 5. Création de l'instance EC2 =====
-<sxh hcl>+<sxh json>
 resource "aws_instance" "zerp_ec2" { resource "aws_instance" "zerp_ec2" {
   ami           = "ami-xxxxxxxx"   ami           = "ami-xxxxxxxx"
Ligne 81: Ligne 81:
  
 ===== 6. Fichier terraform.tfvars ===== ===== 6. Fichier terraform.tfvars =====
-<sxh hcl>+<sxh json>
 public_key_path = "C:/Users/ton_user/.ssh/id_rsa.pub" public_key_path = "C:/Users/ton_user/.ssh/id_rsa.pub"
 </sxh> </sxh>
Ligne 98: Ligne 98:
  
 Valider avec : Valider avec :
-<sxh bash> +''yes''
-yes +
-</sxh>+
  
  
 ===== 9. Récupération de l’IP ===== ===== 9. Récupération de l’IP =====
-<sxh bash>+<sxh bash;gutter:false>
 terraform show terraform show
 </sxh> </sxh>
  
 Chercher : Chercher :
-<sxh>+<sxh;gutter:false>
 public_ip = "xxx.xxx.xxx.xxx" public_ip = "xxx.xxx.xxx.xxx"
 </sxh> </sxh>
Ligne 116: Ligne 114:
 ===== 10. Connexion SSH ===== ===== 10. Connexion SSH =====
 ==== Amazon Linux ==== ==== Amazon Linux ====
-<sxh bash>+<sxh bash;gutter:false>
 ssh -i $HOME/.ssh/id_rsa ec2-user@IP ssh -i $HOME/.ssh/id_rsa ec2-user@IP
 </sxh> </sxh>
  
 ==== Ubuntu ==== ==== Ubuntu ====
-<sxh bash>+<sxh bash;gutter:false>
 ssh -i  $ HOME/.ssh/id_rsa ubuntu@IP ssh -i  $ HOME/.ssh/id_rsa ubuntu@IP
 </sxh> </sxh>
Ligne 128: Ligne 126:
 ===== 11. Vérification ===== ===== 11. Vérification =====
 Si tout fonctionne : Si tout fonctionne :
-<sxh bash>+<sxh bash;gutter:false>
 [ec2-user@ip-xxx-xxx-xxx-xxx ~] $  [ec2-user@ip-xxx-xxx-xxx-xxx ~] $ 
 </sxh> </sxh>
Ligne 149: Ligne 147:
   * Utiliser des variables Terraform   * Utiliser des variables Terraform
   * Ne jamais versionner les clés privées   * Ne jamais versionner les clés privées
-  * Utiliser terraform.tfvars pour les configs locales+  * Utiliser **terraform.tfvars** pour les configs locales
  • eadl/bloc4/fm4/td1.1776191853.txt.gz
  • Dernière modification : il y a 9 jours
  • de jcheron