Lab 1 Terraform
Lab 1 Terraform
Disclaimer
Before you proceed with this lab, carefully read and understand the following points:
1. AWS Costs: Using AWS resources may incur charges. Always monitor your
usage via the AWS Billing Dashboard. You are responsible for any costs
associated with this lab.
2. AWS Credentials: Handle your credentials securely. Never share them, upload
them to repositories, or expose them publicly. Misuse of credentials can lead to
unauthorized access and charges.
3. Resource Management: Ensure you destroy all resources created during the
lab to avoid unnecessary costs.
4. Environment Assumptions: This lab assumes the following:
o VS Code is installed on your system.
o You have a valid AWS account with necessary permissions.
o You are working on a Windows environment.
aws --version
You should see the installed AWS CLI version.
aws configure
terraform –version
terraform {
required_providers {
aws = {
source = "hashicorp/aws"
version = "5.82.2"
}
}
}
provider "aws" {
region = "us-east-1" # Replace with your preferred region
}
4. Save the file.
tags = {
Name = "TerraformEC2"
}
}
o Use the AWS Console or CLI to find an AMI ID appropriate for your region.
2. Save the file.
This downloads the required provider and prepares Terraform to execute your
configuration.
terraform validate
terraform plan
Terraform will output the actions it plans to take, such as creating an EC2
instance.
terraform apply
terraform destroy