Setting Up AWS CLI

How to install, configure, and authenticate the AWS Command Line Interface to manage Amazon Web Services from your terminal.

AWSCLICloudSetupAuthentication

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)

bash
brew install awscli

Linux

bash
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:

powershell
winget install Amazon.AWSCLI

Configuration

Run the configure command and enter your credentials:

bash
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:

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

Tip

Pro Tip: Multiple Profiles Use named profiles for different AWS accounts:
bash
aws configure --profile work
aws s3 ls --profile work