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

81 lines
2.1 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# 1) Install Terraform & Configure AWS (15 min)
Well install Terraform and set up your AWS credentials on **Ubuntu 24.04**.
### A. Install Terraform
```bash
sudo apt-get update
```
Updates the local package index so your system knows about the latest software versions.
```bash
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
```bash
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.
```bash
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.
```bash
sudo apt update && sudo apt install -y terraform && clear
```
Refreshes package list again and installs the latest Terraform release.
```bash
terraform -v
```
Verifies Terraform is installed by printing its version.
### B. Install AWS CLI v2
```bash
sudo apt-get install -y unzip
```
Installs **unzip**, required to extract the AWS CLI package.
```bash
curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"
```
Downloads the AWS CLI v2 installer.
```bash
unzip awscliv2.zip
```
Extracts the AWS CLI installer files.
```bash
sudo ./aws/install
```
Runs the AWS CLI installer to make it available system-wide.
```bash
aws --version
```
Checks that AWS CLI is installed successfully.
### C. Configure AWS credentials
```bash
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.