Install AWS CLI on Ubuntu: Step-by-Step Guide
Install AWS CLI v2 on Ubuntu 22.04 and 24.04 using the official installer, snap, or pip. Configure credentials, test with Terraform, and set up autocomplete.
DevOps
Install AWS CLI v2 on Windows using winget in one command. Configure credentials, set up PowerShell autocomplete, and verify with Terraform.
winget is the built-in package manager in Windows 10/11. One command installs AWS CLI v2 — no MSI download, no browser needed.
Open PowerShell or Command Prompt:
winget install Amazon.AWSCLIThat's it. Close and reopen your terminal, then verify:
aws --version
# aws-cli/2.17.x Python/3.12.x Windows/10 exe/AMD64If winget isn't available:
# Download and run the MSI
msiexec.exe /i https://awscli.amazonaws.com/AWSCLIV2.msiOr download from https://awscli.amazonaws.com/AWSCLIV2.msi and double-click.
aws configure
# AWS Access Key ID [None]: AKIA...
# AWS Secret Access Key [None]: ****
# Default region name [None]: us-east-1
# Default output format [None]: jsonCredentials are stored in %USERPROFILE%\.aws\credentials.
aws configure --profile production
# Use in Terraform:
$env:AWS_PROFILE = "production"
terraform planaws configure sso
aws sso login --profile my-org
$env:AWS_PROFILE = "my-org"
terraform plan# Check identity
aws sts get-caller-identity
# List S3 buckets
aws s3 ls
# Terraform uses same credentials
terraform init
terraform planwinget upgrade Amazon.AWSCLIwinget uninstall Amazon.AWSCLI# Add to $PROFILE
Register-ArgumentCompleter -Native -CommandName aws -ScriptBlock {
param($wordToComplete, $commandAst, $cursorPosition)
$env:COMP_LINE = $commandAst.ToString()
$env:COMP_POINT = $cursorPosition
aws_completer.exe | ForEach-Object {
[System.Management.Automation.CompletionResult]::new($_, $_, 'ParameterValue', $_)
}
Remove-Item Env:\COMP_LINE
Remove-Item Env:\COMP_POINT
}# While you're at it
winget install HashiCorp.Terraform
terraform versionClose and reopen your terminal after installation. If still not found:
# Check if aws.exe exists
Get-Command aws -ErrorAction SilentlyContinue
# Add to PATH manually if needed
$env:PATH += ";C:\Program Files\Amazon\AWSCLIV2"# Verify credentials exist
aws configure list
# Check for environment variable overrides
Get-ChildItem env:AWS_*Windows 10 version 1809+ and Windows 11 include winget. If missing:
# Install from Microsoft Store: "App Installer"
# Or use the MSI method abovewinget install Amazon.AWSCLI is the fastest way to get AWS CLI on Windows. One command, auto-updates with winget upgrade, and credentials work automatically with Terraform. No browser download needed.
Install AWS CLI v2 on Ubuntu 22.04 and 24.04 using the official installer, snap, or pip. Configure credentials, test with Terraform, and set up autocomplete.
Install Terraform on Amazon Linux 2023 using the HashiCorp repository or manual binary download. Verify installation, configure autocomplete
Install Terraform on Debian 12 Bookworm using the HashiCorp APT repository or manual binary download. Includes verification, autocomplete setup
Install and manage multiple Terraform versions with tfenv. Switch between versions per project, auto-detect from .terraform-version files