How to Set up AWS CLI path on MacOS/Linux/Windows Operating system

How to Set up AWS CLI path on MacOS/Linux/Windows Operating system

You should find that the AWS program is already present in your operating system’s PATH environment variable once you have installed the AWS CLI. You may not be able to add the AWS program if you installed it in a custom location or if you did not have proper permissions to have paths created during the installation process. If the AWS command does not run after installing it, you might need to configure it manually.

Please use the following instructions to add the AWS CLI to your PATH, depending on your operating system.

Linux and macOS

1. Locate the profile script for your shell in the user directory. It is recommended that you echo $SHELL if you are unsure which shell you have.

 $ 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. In the script for your profile, add a command for exporting the profile. You can do this by adding the following command to the current PATH variable.

export PATH=/usr/local/bin:$PATH

3.  Make sure you reload the updated profile into your current session.

$ source ~/.bash_profile

Windows

1. You can find the AWS file location by utilizing the where command, which has the /R path parameter, in a Windows Command Prompt. It will return all the folders that contain the AWS file.

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

The AWS CLI version 2 is located by default in the following directory:

c:\Program Files\Amazon\AWSCLIV2\aws.exe  

2. Enter the environment variables by pressing the Windows key.

ALSO READ  How does using SQS help reduce Lambda costs?

3. Choose Edit environment variables for your account from the list of suggestions that appears.

4. Select PATH, and then select Edit.

5. The path you identified in the first step should be entered in the Variable value field, for example,

C:\Program Files\Amazon\AWSCLIV2\aws.exe.

6. Once the new settings have been applied, click OK twice.

7. If any command prompts are running, close them and reopen the command prompt window.

Abhay Singh

I'm Abhay Singh, an Architect with 9 Years of It experience. AWS Certified Solutions Architect.

More Reading

Post navigation

Leave a Comment

Leave a Reply

Your email address will not be published. Required fields are marked *