How to Install AWS CLI: Step-by-Step Guide
To install the
AWS CLI, download the installer for your operating system from the official AWS website or use a package manager like pip for Python. After installation, verify it by running aws --version in your terminal or command prompt.Syntax
The basic command to check if AWS CLI is installed is aws --version. To install AWS CLI, you use different commands depending on your operating system:
- Windows: Run the downloaded MSI installer.
- macOS: Use
brew install awscliif Homebrew is installed. - Linux: Use the bundled installer script or
pip install awscli(for AWS CLI v1 only).
bash
aws --version
Example
This example shows how to install AWS CLI on macOS using Homebrew and verify the installation.
bash
brew install awscli aws --version
Output
aws-cli/2.13.8 Python/3.11.4 Darwin/22.6.0 source/x86_64 prompt/off
Common Pitfalls
Common mistakes include:
- Not adding AWS CLI to your system PATH, so the command is not recognized.
- Using outdated installation methods or versions.
- Confusing AWS CLI v1 and v2 installers.
Always use the latest official installer or package manager commands.
bash
## Wrong: Using pip for AWS CLI v2 (not supported)
pip install awscli
## Right: Use official installer or package manager
# For macOS with Homebrew
brew install awscliQuick Reference
| Platform | Installation Method | Command or Link |
|---|---|---|
| Windows | MSI Installer | https://awscli.amazonaws.com/AWSCLIV2.msi |
| macOS | Homebrew | brew install awscli |
| Linux | Bundled Installer | curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip" |
| Any OS | Python pip (v1 only) | pip install awscli |
Key Takeaways
Use the official AWS CLI installer or package manager for your OS.
Verify installation by running 'aws --version' in your terminal.
Avoid using pip for AWS CLI version 2; it supports only version 1.
Ensure AWS CLI is added to your system PATH to run commands anywhere.
Keep AWS CLI updated to access the latest features and fixes.