Step-by-Step Guide to Setting Up Terraform, AWS CLI, and Your AWS Environment
Cloud DevOps Engineer
Wondering how to start playing around with resources in AWS? No worries, I've got you covered!
Step 1: Set Up Your AWS Account
If you don’t have an AWS account, sign up at aws.amazon.com.
Log in to the AWS Console here: https://aws.amazon.com/console/ and you land on the official dashboard

In the search bar at the top, search “IAM” then click enter:

Click “Create user” to create a user for our terraform role with the name: terraform_user

You can then set permissions from the 3 options provided. For this lab we use,”Attach Policies directly” then select “AdministratorAccess” from the list of policies provided as shown below

Review the IAM User details then click “Create”:

Your terraform user will be created and displayed in the Users section:

Click the “terraform_user” to open up more details, then click “Security Credentials” as shown below:

Scroll down to “Create access key” and click, then select your use case:

then create access key

Boom, you now have an access key for your “terraform_user” similar to the one attached below: Download the .csv file to your local storage for retrieval

Step 2: Install AWS CLI
Download and install the AWS CLI from AWS documentation
Run aws configure in the terminal to set up your credentials.

Enter the AWS Access Key ID from your terraform_user you retrieved and the AWS Secret Access Key

For the region, enter a region where you want your resources to be provisioned eg. us-east-1 and the output format eg json

Step 3: Install Terraform
Download Terraform from terraform.io
Follow installation steps for your OS (Windows/Mac/Linux)
Verify installation with terraform —version on your command line as shown below

Step 4: Configure Terraform with AWS
Create a Terraform directory and add a basic configuration file ( main.tf)

Initialize Terraform with terraform init

Run terraform plan to preview changes in your resources

Apply the configuration with terraform apply , enter “yes” when prompted to approve, and boom your resources have been successfully created:

You can delete the resources using terraform destroy as shown below:



