π Terraform Series β Day 2

Gujjar Apurv is a passionate DevOps Engineer in the making, dedicated to automating infrastructure, streamlining software delivery, and building scalable cloud-native systems. With hands-on experience in tools like AWS, Docker, Kubernetes, Jenkins, Git, and Linux, he thrives at the intersection of development and operations. Driven by curiosity and continuous learning, Apurv shares insights, tutorials, and real-world solutions from his journeyβmaking complex tech simple and accessible. Whether it's writing YAML, scripting in Python, or deploying on the cloud, he believes in doing it the right way. "Infrastructure is code, but reliability is art."
Terraform Setup on AWS EC2 & Local (Ubuntu , window )
In Day 1, we understood the fundamentals of Terraform and Infrastructure as Code (IaC).
Now, in Day 2, we will set up Terraform in real environments.
This guide covers installation on:
AWS EC2 (Ubuntu)
Local Ubuntu Machine
Windows (using Chocolatey)
π― Objective
Install Terraform in different environments
Follow secure installation practices
Verify installation properly
βοΈ Part 1: Setup on AWS EC2 (Ubuntu)
π§± Step 1: Create EC2 Instance
Go to AWS EC2 Dashboard
Click Launch Instance
Select:
OS β Ubuntu
Instance Type β t2.micro (Free Tier)
Create key pair
Launch instance
π Step 2: Connect via SSH
ssh -i your-key.pem ubuntu@your-ec2-public-ip
π¦ Step 3: Update System
sudo apt-get update && sudo apt-get install -y gnupg software-properties-common
π Step 4: Add HashiCorp GPG Key
wget -O- https://apt.releases.hashicorp.com/gpg | \
gpg --dearmor | \
sudo tee /usr/share/keyrings/hashicorp-archive-keyring.gpg > /dev/null
β Step 5: Verify GPG Key
gpg --no-default-keyring \
--keyring /usr/share/keyrings/hashicorp-archive-keyring.gpg \
--fingerprint
π Ensures authenticity and security
π Step 6: Add Repository
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
π Step 7: Update Packages
sudo apt-get update
βοΈ Step 8: Install Terraform
sudo apt-get install terraform
π Step 9: Verify Installation
terraform --version
π» Part 2: Local Installation (Ubuntu)
π Follow the same steps as EC2
No changes required β works exactly the same.
πͺ Part 3: Terraform Installation on Windows
π¦ Step 1: Install using Chocolatey
choco install terraform
π Make sure Chocolatey is installed on your system
π Step 2: Verify Installation
Open a new terminal (CMD/PowerShell):
terraform -help
Expected output:
Usage: terraform [global options] <subcommand> [args]
π Shows all available Terraform commands
β‘ Enable Autocomplete (Optional but Recommended)
π§ Bash
touch ~/.bashrc
terraform -install-autocomplete
π Zsh
touch ~/.zshrc
terraform -install-autocomplete
π Restart terminal after this step
π Alternative Installation Method
You can also install Terraform using the official HashiCorp documentation depending on your OS and requirements.
Terraform official Documentation
π¨βπ» About the Author
βThis Kubernetes series focuses on building a strong foundation by understanding real Kubernetes concepts step by step.β
π¬ Let's Stay Connected
π§ Email: gujjarapurv181@gmail.com
π GitHub: github.com/ApurvGujjar07
πΌ LinkedIn: linkedin.com/in/apurv-gujjar






