ad4469dc-7beb-4b7f-90b1-7de.../docs/01_install_setup.md

2.1 KiB
Raw Blame History

1) Install Terraform & Configure AWS (15 min)

Well install Terraform and set up your AWS credentials on Ubuntu 24.04.

A. Install Terraform

sudo apt-get update

Updates the local package index so your system knows about the latest software versions.

sudo apt-get install -y gnupg software-properties-common wget

Installs essential tools:

  • gnupg → handles security keys
  • software-properties-common → helps manage repositories
  • wget → used to download files
wget -O- https://apt.releases.hashicorp.com/gpg | gpg --dearmor | sudo tee /usr/share/keyrings/hashicorp.gpg

Downloads and stores HashiCorps official GPG key for verifying Terraform packages.

echo "deb [signed-by=/usr/share/keyrings/hashicorp.gpg] https://apt.releases.hashicorp.com $(lsb_release -cs) main" | sudo tee /etc/apt/sources.list.d/hashicorp.list

Adds the HashiCorp package repository to your system so Terraform can be installed and updated.

sudo apt update && sudo apt install -y terraform && clear

Refreshes package list again and installs the latest Terraform release.

terraform -v

Verifies Terraform is installed by printing its version.

B. Install AWS CLI v2

sudo apt-get install -y unzip

Installs unzip, required to extract the AWS CLI package.

curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"

Downloads the AWS CLI v2 installer.

unzip awscliv2.zip

Extracts the AWS CLI installer files.

sudo ./aws/install

Runs the AWS CLI installer to make it available system-wide.

aws --version

Checks that AWS CLI is installed successfully.

C. Configure AWS credentials

aws configure

Starts interactive setup for AWS CLI. Enter:

  • AWS Access Key ID: (from your IAM user)
  • AWS Secret Access Key: (from your IAM user)
  • Default region name: ap-south-1 (Mumbai, for this lab)
  • Default output format: json

This creates config files (~/.aws/config and ~/.aws/credentials) so both AWS CLI and Terraform can connect securely to AWS.