Step-by-Step Guide to Setting Up Terraform, AWS CLI, and Your AWS Environment.


Reading: Chapter 2 of "Terraform: Up & Running" by Yevgeniy (Jim) Brikman, focusing on "Setting Up Your AWS Account", and "Installing Terraform."
Activity: Setting up AWS and Terraform Development Environment
Set up your AWS account.
Go to AWS website and click "Create an AWS Account"
Complete the registration process providing email, password, and account information
Enter payment information, credit card required, even for free tier
Complete phone verification
Select a support plan, Free tier recommended for beginners
Install Terraform locally.
Download Terraform from terraform.io/downloads
Extract the downloaded zip file
Add Terraform to your system PATH:
Windows: Move terraform.exe to a directory in your PATH or add its location to PATH
macOS/Linux: Move the terraform binary to /usr/local/bin/
Verify installation by opening a terminal and typing:
terraform -version
Install AWS CLI and configure it.
Download AWS CLI:
Windows: Download and run the MSI installer
macOS: Run
brew install awscli
or download the PKG installerLinux: Run appropriate package manager command (e.g.,
apt install awscli
)
Configure AWS CLI by running:
aws configure
Enter your AWS Access Key ID, Secret Access Key, default region, and output format
Find your access keys in the AWS Console under IAM → Security credentials
Install Visual Studio Code (VSCode) and add the AWS plugin.
Download VSCode from code.visualstudio.com
Install VSCode on your system
Open VSCode and navigate to Extensions (Ctrl+Shift+X or Cmd+Shift+X)
Search for "AWS Toolkit" and install it
Also install the "HashiCorp Terraform" extension for Terraform support
Configure your VSCode to work with AWS.
Click on the AWS icon in the activity bar
Select "Connect to AWS"
Choose to use the credentials from your AWS CLI configuration
Verify connection by expanding your region in the AWS Explorer panel
Configure Terraform settings in VSCode:
Go to Settings (Ctrl+,)
Search for "terraform" and adjust formatting settings as needed
Enable auto-formatting and validation features
Subscribe to my newsletter
Read articles from Mwanza Simi directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by
