AWS setup - CPNV-ES-MAS3-X/LibreNMS-Containerization GitHub Wiki
Récupérer le fichier msi sur le site d’amazone aws ou exécuter la commande suivante dans un terminal
msiexec.exe /i https://awscli.amazonaws.com/AWSCLIV2.msi
Lien pour le téléchargement: https://docs.aws.amazon.com/cli/latest/userguide/getting-started-install.html
CLI setup
PS C:\Users\Ilan> aws --version
aws-cli/2.11.21 Python/3.11.3 Windows/10 exe/AMD64 prompt/off
PS C:\Users\Ilan> aws configure
AWS Access Key ID [None]: AKIA2KFJKL4O2MWSCBAG
AWS Secret Access Key [None]: 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
Default region name [None]: eu-central-1
Default output format [None]: json
PS C:\Users\Ilan>
Start instance
C:\Users\andre>aws ec2 start-instances --instance-ids i-0ee0bf7834ec0f46f i-00a16e820352732ad i-0713a2a720380bed9
{
"StartingInstances": [
{
"CurrentState": {
"Code": 16,
"Name": "running"
},
"InstanceId": "i-0ee0bf7834ec0f46f",
"PreviousState": {
"Code": 16,
"Name": "running"
}
},
{
"CurrentState": {
"Code": 0,
"Name": "pending"
},
"InstanceId": "i-00a16e820352732ad",
"PreviousState": {
"Code": 0,
"Name": "pending"
}
},
{
"CurrentState": {
"Code": 0,
"Name": "pending"
},
"InstanceId": "i-0713a2a720380bed9",
"PreviousState": {
"Code": 80,
"Name": "stopped"
}
}
]
}
Récupérer les deux fichiers .PEM sous «Fichiers» du groupe teams
Ouvrir un premier terminal afin de créer le tunnel afin de se connecter à notre infrastructure aws
[INPUT]
C:\Users\andre\Downloads>ssh [email protected] -i KEYPAIR_SSHSRV_LIBRENMS.pem -L 1022:10.0.2.10:22 -L 1080:10.0.2.10:80
[OUTPUT]
Linux ip-10-0-0-20 5.10.0-23-cloud-amd64 #1 SMP Debian 5.10.179-1 (2023-05-12) x86_64
The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.
Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
Last login: Mon May 22 21:09:18 2023 from 194.230.158.5
librenms@ip-10-0-0-20:~$
ATTENTION! Ce terminal ne doit pas être fermé!
Ouvrir un second terminal afin de se connecter à la machine
[INPUT]
PS C:\Users\andre\Downloads> ssh admin@localhost -p 1022 -i KEYPAIR_LIBRENMS.pem
[OUTPUT]
Linux ip-10-0-2-10 5.10.0-23-cloud-amd64 #1 SMP Debian 5.10.179-1 (2023-05-12) x86_64
The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.
Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
Last login: Mon May 22 21:10:50 2023 from 10.0.0.20
admin@ip-10-0-2-10:~$
Backup 1
Sur la machine concernée, exécuter la commande aws configure
avec les différentes clefs requises
Procéder ensuite avec la commande aws ec2 create-image
Ici nous avons fait un backup de notre machine debian 11 "vierge"
[INPUT]
admin@ip-10-0-2-10:~$ aws configure
AWS Access Key ID [None]: AKIA2KFJKL4O2MWSCBAG
AWS Secret Access Key [None]: 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
Default region name [None]: eu-central-1
Default output format [None]: json
[INPUT]
admin@ip-10-0-2-10:~$ aws ec2 create-image --instance-id i-0713a2a720380bed9 --name "MON1-LIBRENMS" --description "Backup de la machine vierge (sans install)"
[OUTPUT]
{
"ImageId": "ami-003b574ba8f4efba3"
}
admin@ip-10-0-2-10:~$
Backup 2
Faire un second backup après l'installation des prerequis
[INPUT]
admin@ip-10-0-2-10:~$ aws ec2 create-image --instance-id i-0713a2a720380bed9 --name "MON1-LIBRENMS2" --description "Install prerequis"
[OUTPUT]
{
"ImageId": "ami-09ca293c9dc956fa1"
}