How to Install Terraform & AWS CLI on Windows 11

Be A Better DevAbout 4 min readMay 27, 2025Watch original
THE SUMMARYAI-generated

Terraform and AWS Setup on Windows 11: A Detailed Guide

Key Concepts:

  • Terraform CLI: Infrastructure as Code (IaC) tool for managing cloud resources.
  • AWS CLI: Command-line interface for interacting with AWS services.
  • AWS IAM: Identity and Access Management, used for creating users and managing permissions.
  • S3 Bucket: Simple Storage Service, an object storage service offered by AWS.
  • Provider: Terraform configuration that specifies the cloud provider (e.g., AWS).
  • Resource: A component of infrastructure that Terraform manages (e.g., an S3 bucket).
  • Access Key ID & Secret Access Key: Credentials used to authenticate with AWS.
  • Path Variables: System settings that define where the operating system searches for executable files.

1. Installing the Terraform CLI

  • Downloading Terraform:
    • Navigate to developer.hashicorp.com/terraform/install.
    • Select the appropriate Windows version (32-bit or 64-bit). Determine your system type by pressing the Windows key, typing "about," and checking "System type" in the "About your PC" settings.
    • Download the AMD64 version for 64-bit systems.
  • Extracting and Placing Terraform:
    • Extract the downloaded ZIP file to the Downloads directory.
    • Copy the terraform.exe and license.txt files.
    • Create a new directory named "Terraform" in the C: drive (C:\Terraform).
    • Paste the copied files into the C:\Terraform directory.
  • Setting up Path Variables:
    • Press the Windows key, type "environment," and select "Edit the system environment variables."
    • Click "Environment Variables."
    • In the "System variables" section, find and select "Path," then click "Edit."
    • Click "New" and then "Browse."
    • Navigate to the C:\Terraform directory and select it.
    • Click "OK" on all open windows to save the changes.
  • Verifying Installation:
    • Open a new PowerShell terminal (important: a new terminal is required to load the updated path).
    • Type terraform. If Terraform is installed correctly, it will display the Terraform CLI help information.

2. Installing and Configuring the AWS CLI

  • Installing the AWS CLI:
    • Navigate to docs.aws.amazon.com/cli/latest/userguide/install-cliv2-windows.html (or search "install AWS CLI" on Google).
    • Download and run the AWS CLI MSI installer for 64-bit Windows.
    • Follow the on-screen instructions to complete the installation.
  • Verifying Installation:
    • Open a new PowerShell terminal.
    • Type aws --version. This should display the AWS CLI version.
  • Configuring AWS Credentials:
    • Type aws configure.
    • The CLI will prompt for:
      • AWS Access Key ID: Obtained from the AWS IAM console.
      • AWS Secret Access Key: Obtained from the AWS IAM console.
      • Default region name: e.g., us-east-1 (North Virginia).
      • Default output format: Leave blank (press Enter).
  • Obtaining AWS Credentials (IAM User Setup):
    • Log in to the AWS Management Console.
    • Navigate to IAM (Identity and Access Management).
    • Go to "Users" and click "Add user."
    • Enter a username (e.g., "demo").
    • Select "Access key - Programmatic access."
    • Click "Next: Permissions."
    • Select "Attach existing policies directly."
    • Search for and select the "AdministratorAccess" policy (grants full access). Note: In a production environment, it's best practice to grant only the necessary permissions.
    • Click "Next: Tags" (optional).
    • Click "Create user."
    • On the success page, copy the "Access key ID" and "Secret access key." Important: This is the only time you can view the secret access key. Store it securely.
    • Paste the Access Key ID and Secret Access Key into the AWS CLI when prompted by aws configure.
  • Testing the AWS CLI Configuration:
    • Type aws lambda list-functions --region us-east-1.
    • If configured correctly, this will list the Lambda functions in your AWS account in the specified region.

3. Deploying Infrastructure with Terraform

  • Creating a Terraform Project:

    • Create a new directory for your Terraform project (e.g., "terraform-demo").
    • Create a file named main.tf inside the project directory.
  • Defining the AWS Provider:

    • Add the following code to main.tf to configure the AWS provider:
    provider "aws" {
      region = "us-east-1" # Replace with your preferred region
    }
    
  • Defining an S3 Bucket Resource:

    • Add the following code to main.tf to define an S3 bucket:
    resource "aws_s3_bucket" "my_demo_bucket" {
      bucket = "my-demo-bucket-999999" # Replace with a unique bucket name
      acl    = "private"
    }
    
    • Note: S3 bucket names must be globally unique across all AWS accounts.
  • Initializing Terraform:

    • Open a terminal and navigate to your Terraform project directory.
    • Run terraform init. This initializes the Terraform working directory and downloads the necessary provider plugins.
  • Applying the Terraform Configuration:

    • Run terraform apply.
    • Terraform will display a plan of the changes it will make to your infrastructure.
    • Type yes to confirm and apply the changes.
  • Verifying the S3 Bucket Creation:

    • Log in to the AWS Management Console.
    • Navigate to S3.
    • You should see the S3 bucket you created (e.g., "my-demo-bucket-999999") in the list of buckets.

Conclusion

This video provides a step-by-step guide to setting up Terraform and the AWS CLI on Windows 11. It covers installing the necessary tools, configuring AWS credentials, and deploying a simple S3 bucket using Terraform. The video emphasizes the importance of securing AWS credentials and using unique names for S3 buckets. By following these steps, users can begin managing their AWS infrastructure using Terraform's Infrastructure as Code approach.

AI summaries can miss context or contain errors. Check important details against the original video.

Go a little deeper.

Have a question about this video? Load its transcript to open the video chat.