-bash aws command not found
System Design practice on Codemia
Work through 120+ system design problems with detailed solutions, from rate limiters to multi-region storage.
Introduction
The error -bash: aws: command not found means your shell cannot locate the aws CLI binary. This happens because the AWS CLI is not installed, or its installation directory is not in your PATH environment variable. The fix is either to install the AWS CLI or to add its install location to your PATH.
Check If AWS CLI Is Installed
Fix 1: Install AWS CLI v2
macOS
Linux (x86_64)
Linux (ARM)
Windows
pip (AWS CLI v1 — legacy)
Fix 2: Add AWS CLI to PATH
If aws is installed but your shell cannot find it, the install directory is not in your PATH:
Fix 3: pip Install Not in PATH
When installed via pip, the aws binary goes into Python's scripts directory, which may not be in your PATH:
Fix 4: Symlink the Binary
If aws is installed in a non-standard location, create a symlink:
Fix 5: Docker / Container Environments
In Docker containers, AWS CLI is not pre-installed:
Verify Installation
Common Pitfalls
- Wrong shell config file: Editing
~/.bashrcwhen your terminal uses zsh (default on macOS since Catalina). Check your shell withecho $SHELLand edit the correct file (~/.zshrcfor zsh). - Forgetting to source: After editing
~/.bashrcor~/.zshrc, runsource ~/.bashrcor open a new terminal. Changes do not apply to the current session automatically. - sudo vs user install:
sudo ./aws/installputs the binary in/usr/local/bin/. Withoutsudo, it installs to~/.local/bin/which may not be in yourPATH. - Multiple Python versions:
pip install awscliinstalls for one Python version. If your defaultpythonchanges, theawsbinary may point to the wrong Python. Usepip3explicitly. - AWS CLI v1 vs v2:
pip install awscliinstalls v1 (legacy). The official installer installs v2. They have different install locations and some command differences.
Summary
- The error means the
awsbinary is not in your shell'sPATH - Install AWS CLI v2 using the official installer (not pip) for the latest features
- Add the install directory to
PATHin your shell config file (~/.bashrc,~/.zshrc, or~/.bash_profile) - Use
which awsandecho $PATHto diagnose path issues - Run
source ~/.bashrcafter editing to apply changes to the current session - Use
aws --versionto verify the installation is working
Related reading
- 1000 On prem apps sending data to cloud
- 3 fields composite primary key unique item in Dynamodb
- 502 bad gateway errors when using ALB and aws-load-balancer-controller
- A client error 400 occurred when calling the HeadObject operation Bad Request Completed 1 parts with ... files remaining
- -bash bin/kafka-topics.sh No such file or directory installed via ambari
- -bash kafka-server-start.sh command not found
- A default binder has been requested, but there are no binders available for ''org.springframework.cloud.stream.messaging.DirectWithAttributesChannel''
- Access AWS S3 from Lambda within VPC

System Design Fundamentals
Build a strong foundation in designing scalable, reliable distributed systems.
View the courseTrack what you have practised
A free account saves your progress, solutions and study plan across every problem on Codemia.
System Design practice on Codemia
Work through 120+ system design problems with detailed solutions, from rate limiters to multi-region storage.