01 Overview
The AWS CLI wraps the AWS API in a consistent set of commands so you can manage EC2, S3, IAM, and virtually every other service from scripts or a terminal, using the same credentials and profiles your infra-as-code tools read from.
→ official documentation02 Installation
Pick a platform. Each step is copy-pasteable on its own.
01 Download the installer
curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"
02 Unzip it
sudo apt-get install -y unzip unzip awscliv2.zip
03 Run the installer
sudo ./aws/install
04 Verify
aws --version
01 Download the installer
curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"
02 Unzip it
sudo dnf install -y unzip unzip awscliv2.zip
03 Run the installer
sudo ./aws/install
04 Verify
aws --version
01 Install via Homebrew
brew install awscli
02 Verify
aws --version
Note — commands assume sudo privileges and an up-to-date package index. Pin a specific version in production rather than tracking latest.
03 Install script
The steps above bundled into a single idempotent shell script for provisioning boxes unattended.
install-aws-cli.sh
Ubuntu/Debian target · safe to re-run · exits non-zero on failure
04 Cheatsheet
The commands reached for most often once AWS CLI is installed.
| Command | What it does |
|---|---|
| aws configure | Set access key, secret, region, and output format |
| aws sts get-caller-identity | Confirm which identity/account you're using |
| aws s3 ls | List S3 buckets |
| aws s3 sync ./dir s3://bucket/path | Sync a local directory to S3 |
| aws ec2 describe-instances | List EC2 instances and their state |
| aws --profile name <cmd> | Run a command against a named profile |
| aws logs tail /log/group --follow | Stream CloudWatch logs |