why do I need to create the symlinks and what does folder/in/path corresponds to ? when Installing aws cli 2 on mac for current user

Viewed 2844

I am trying to install AWS cli 2 for the current user, on mac as per blog https://docs.aws.amazon.com/cli/latest/userguide/install-cliv2-mac.html#cliv2-mac-install-cmd-current-user

AWS got installed correctly, I am not able to understand the fourth point, why do I need to create the symlinks and what does folder/in/path corresponds to

4. Finally, you must create a symlink file in your $PATH that points to the actual aws and aws_completer programs. Because standard user permissions typically don't allow writing to folders in the path, the installer in this mode doesn't try to add the symlinks. You must manually create the symlinks after the installer finishes. If your $PATHincludes a folder you can write to, you can run the following command without sudo if you specify that folder as the target's path. If you don't have a writable folder in your $PATH, then you must use sudo in the commands to get permissions to write to the specified target folder.

$ sudo ln -s /folder/installed/aws-cli/aws /folder/in/path/aws
$ sudo ln -s /folder/installed/aws-cli/aws_completer /folder/in/path/aws_completer
1 Answers

There are two ways to configure path of the aws program which is under the folder aws-cli,

First way

Add the path of folder aws-cli to our PATH variable using the following command
export PATH=$PATH:$HOME/aws-cli //assuming aws-cli is installed at $HOME

This is sufficient to start using aws command.

Second way

PATH variable contains path of /usr/local/bin folder=fA and this folder contains links to all the executable programs. So creating a symlink to the /aws-cli/aws in that folder=fA is another way our system can find aws-cli and it is more robust as there is no direct dependency on the PATH variable and that is what the AWS documentation is also referring to

So in my case the commands would like

>> sudo ln -s /Users/akshayjain/aws-cli/aws /usr/local/bin/aws
>> sudo ln -s /Users/akshayjain/aws-cli/aws_completer /usr/local/bin/aws_completer

With either of way you can confirm your installation with following command aws --version

Related