Skip to main content
🔧 Module 0

Build Your Lab

What You'll Install

Before writing a single line of Terraform, your lab needs to be solid. A misconfigured environment is the #1 reason people get stuck on errors that have nothing to do with their code. You need three things: AWS credentials, the AWS CLI, and the Terraform CLI. That's it.

Step 1 — AWS Account & IAM User

1

Go to aws.amazon.com and sign in (or create a free account)

2

Navigate to IAM → Users → Create User

3

Give it a name like "terraform-lab"

4

Attach the policy: AdministratorAccess (for learning — lock this down in real projects)

5

Create the user → Security credentials tab → Create access key

6

Choose "CLI" as the use case → download the .csv file

⚠️ Never commit your access keys to git. Never. Add .tfvars and *.csv to your .gitignore immediately.

Step 2 — Install AWS CLI

bash
# macOS
brew install awscli

# Linux
curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"
unzip awscliv2.zip && sudo ./aws/install

# Windows — download installer from:
# https://aws.amazon.com/cli/

Then configure it with your keys:

bash
aws configure
# AWS Access Key ID: <your key>
# AWS Secret Access Key: <your secret>
# Default region name: us-east-1
# Default output format: json

Step 3 — Verify AWS CLI

bash
aws --version
aws configure list
aws sts get-caller-identity
💡 The last command should return your Account ID and UserId. If it does — your credentials work. If you see "Unable to locate credentials" — rerun aws configure.

Step 4 — Install Terraform CLI

bash
# macOS
brew tap hashicorp/tap
brew install hashicorp/tap/terraform

# Linux (Ubuntu/Debian)
wget -O- https://apt.releases.hashicorp.com/gpg | sudo gpg --dearmor -o /usr/share/keyrings/hashicorp-archive-keyring.gpg
echo "deb [signed-by=/usr/share/keyrings/hashicorp-archive-keyring.gpg] https://apt.releases.hashicorp.com $(lsb_release -cs) main" | sudo tee /etc/apt/sources.list.d/hashicorp.list
sudo apt update && sudo apt install terraform

# Windows — use Chocolatey:
choco install terraform

Step 5 — Verify Terraform

bash
terraform version
# Should output: Terraform v1.x.x

Step 6 — VS Code Setup

1

Install VS Code from code.visualstudio.com

2

Open Extensions (Cmd/Ctrl+Shift+X) → search "HashiCorp Terraform" → Install

3

Also install "AWS Toolkit" extension

4

The Terraform extension gives you: syntax highlighting, autocomplete, hover docs, formatting on save

Lab Check — All Green?

aws sts get-caller-identity returns your account ID
terraform version shows 1.x.x
VS Code has the HashiCorp Terraform extension
You have your access key ID and secret (NOT committed to git)