Setting Up AWS CLI

Last updated: January 2025

This guide walks you through installing and configuring the AWS Command Line Interface (CLI) on macOS, Linux, and Windows.

Prerequisites

  • An AWS account
  • IAM user with programmatic access
  • Access key ID and secret access key

Installation

macOS (Homebrew)

brew install awscli

Linux

curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"
unzip awscliv2.zip
sudo ./aws/install

Windows

Download and run the MSI installer from the AWS website, or use winget:

winget install Amazon.AWSCLI

Configuration

Run the configure command and enter your credentials:

aws configure

# You'll be prompted for:
# AWS Access Key ID: AKIA...
# AWS Secret Access Key: ****
# Default region name: us-east-1
# Default output format: json

Verify Installation

Test your configuration by listing your S3 buckets:

aws --version
aws sts get-caller-identity
aws s3 ls

Pro Tip: Multiple Profiles

Use named profiles for different AWS accounts:

aws configure --profile work
aws s3 ls --profile work