Adding the AWS CLI to your path - AWS Command Line Interface

Adding the AWS CLI to your path

After installing the AWS CLI, the aws program is already in your operating system's PATH environment variable. The aws program may not be added if you installed in a custom location, or if you didn't have proper permissions to have paths created at time of install. If the aws command doesn't run after you install it, you might need to set it manually.

To add the AWS CLI to your PATH, use the following instructions appropriate for your operating system.

Linux and macOS
  1. Find your shell's profile script in your user directory. If you're not sure which shell you have, run echo $SHELL.

    $ ls -a ~ . .. .bash_logout .bash_profile .bashrc Desktop Documents Downloads
    • Bash.bash_profile, .profile, or .bash_login

    • Zsh.zshrc

    • Tcsh.tcshrc, .cshrc, or .login

  2. Add an export command to your profile script. The following command adds your local bin to the current PATH variable.

    export PATH=/usr/local/bin:$PATH
  3. Reload the updated profile into your current session.

    $ source ~/.bash_profile
  1. In a Windows Command Prompt, use the where command with the /R path parameter to find the aws file location. The results return all folders containing aws.

    C:\> where /R c:\ aws c:\Program Files\Amazon\AWSCLI2\aws.exe ...

    By default, the AWS CLI version 2 is located in:

    c:\Program Files\Amazon\AWSCLI2\aws.exe
  2. Press the Windows key and enter environment variables.

  3. From the list of suggestions, choose Edit environment variables for your account.

  4. Choose PATH, and then choose Edit.

  5. Add the path you found in the first step into the Variable value field, for example, C:\Program Files\Amazon\AWSCLI2\aws.exe.

  6. Choose OK twice to apply the new settings.

  7. Close any running command prompts and reopen the command prompt window.