AWS CLI PATH settings: install location and adding aws to PATH
Codemia Knowledge Hub ·
To run aws from any directory, the folder that holds the AWS CLI executable must be on your PATH. On macOS and Linux that is usually /usr/local/bin (or /usr/bin), added in ~/.bash_profile or ~/.zshrc. On Windows, add the install folder (C:\Program Files\Amazon\AWSCLIV2 for the version 2 MSI) to the Path environment variable. Then confirm with aws --version.
The PATH environment variable lists the directories the shell searches for executables when you type a command. This works the same way on Linux, macOS and Windows.
Installing the AWS CLI
Make sure the CLI is installed before changing PATH.
macOS and Linux
- Package manager:
- Homebrew (macOS):
brew install awscli - APT (Debian/Ubuntu):
sudo apt-get install awscli
- Bundled installer:
- Download the installer:
- Install it:
Windows
- Use the MSI installer from the AWS CLI documentation page.
Adding the AWS CLI to PATH
macOS and Linux
- Find the install location:
- The AWS CLI is typically installed at
/usr/local/bin/awsor/usr/bin/aws.
- Edit your shell profile:
- Open it in the terminal:
- Add this line:
- Save and exit (
CTRL + X,Y,Enterin nano).
- Load the changes:
- Run:
Windows
- Find the install path:
- The version 2 MSI installs to
C:\Program Files\Amazon\AWSCLIV2by default. Version 1 usedC:\Program Files\Amazon\AWSCLI\bin.
- Set
Path:- Open the Control Panel and go to
System > Advanced system settings > Environment Variables. - Under
System Variables, selectPathand clickEdit. - Add that folder, for example
C:\Program Files\Amazon\AWSCLIV2.
- Verify:
- Open a new Command Prompt window and type:
Verifying the setup
On any platform, check the version:
If it prints the AWS CLI version, the CLI is installed and reachable from any directory.
Steps by platform
| Step | macOS/Linux | Windows |
| Install AWS CLI | Homebrew, APT, or Bundled Installer | MSI Installer |
| Default Install Location | /usr/local/bin/aws | C:\Program Files\Amazon\AWSCLIV2 |
Edit $PATH | Add export PATH="/usr/local/bin:$PATH"
to ~/.bash_profile or ~/.zshrc | Add directory to Path variable in Environment Variables |
| Verify Installation | Run aws --version | Run aws --version |
Other shells and multiple versions
- Other shells:
fish,tcshand similar shells setPATHdifferently. See their documentation. - Multiple AWS CLI versions: If several versions of the AWS CLI or related tools are installed, use directory-specific shell initialization files or version managers such as
nvmorpyenvto avoid conflicts. After system updates or configuration changes, check thatawsstill resolves to the version you expect.
Related reading
- AWS CLI S3 A client error 403 occurred when calling the HeadObject operation Forbidden
- AWS CLI S3 copying file locally using the terminal fatal error An error occurred 404 when calling the HeadObject operation
- AWS cloud formation Template- providing Tags for the stack in the template
- AWS Cloudformation- How to do string Uppercase or lowercase in json/yaml template
- AWS Cloudformation Conditionally create properties of resources
- AWS CloudFormation create-stack vs deploy
- AWS Cloudformation How to reuse bash script placed in user-data parameter when creating EC2?
- AWS CloudFormation Stack update error Requires capabilities CAPABILITY_IAM
System design interview problems on this topic
- Design Dropbox: solution and walkthrough
- Design a Global Content Distribution Network: solution and walkthrough
- Design a Serverless Architecture Framework: solution and walkthrough
- Design Youtube or Netflix: solution and walkthrough

System Design Fundamentals
Build a strong foundation in designing scalable, reliable distributed systems.
View the courseSystem Design practice on Codemia
Work through 120+ system design problems with detailed solutions, from rate limiters to multi-region storage.