Infrastructure as Code with Terraform and AWS. Created by Metadev.
Last revision 2024.02.13
- Git
- Bash Shell
- Editor. Recomended Visual Studio Code + Extension for Terraform
- SSH Client (For example: putty.exe on windows)
- Terraform Add it to your PATH
- aws-cli
-
Clone the repository to local machine
git clone [email protected]:metadevpro/terraform-aws-training.git
-
Enter into each folder for exercices
-
Configure your own AWS credentials exporting enviromental variables for
AWS_ACCESS_KEY_ID
andAWS_SECRET_ACCESS_KEY
or, alternatively setAWS_PROFILE
. -
Create the
keys/
folder and place your PEM and PPK files for execices 1, 2, and 4. -
Init with
terraform init
-
Validate with
terraform validate
-
Deploy with
terraform apply
-
Destroy with
terraform destroy
AWS requires to setup a pair of SSH keys to access the machines.
To do it go to https://eu-south-2.console.aws.amazon.com/ec2/v2/home?region=eu-south-2#KeyPairs: and create a key pair.
The keys must be created for an specific AWS region. In this example using Zaragoza = eu-south-2
.
- The public key will be retained by AWS.
- The private key is the one you are downloading. (Use the PEM format.)
- You need to place it under a
keys/
folder for running examples 1, 2 and 4.
For Windows users using Putty: Putty needs the key in an special format: PPK.
To convert the PEM file into a PPK use puttygen.exe
to convert the key:
- Load the PEM file
- Save the private key as PPK file.
Puttygen.exe can be downloaded here.
When using *.pem files for SSH (especially on Mac OS and Linux) ensure key file has read persmissions for the user only with the command:
chmod 600 <file>.pem
- Create an AWS EC2 virtual machine.
- Deploy a complete static website in S3.
- Create an AWS EC2 virtual machine + docker containers.
- Create a complete CI Server: Teamcity with EC2 and docker.
Using samples in AWS accounts will incurr in small charges. Remember always to destroy your resources after finalizing the training if not in use.
Licensed under CC BY (c) Metadev 2021-2024.