3

I am following the install directions outlined in this article (https://docs.aws.amazon.com/cli/latest/userguide/awscli-install-linux.html#awscli-install-linux-path)to install the AWS CLI on a Raspberry Pi. (OS: PRETTY_NAME="Raspbian GNU/Linux 9 (stretch)")

The steps are pretty straightforward though I am running into a problem with the section called "Adding the AWS CLI Executable to your Command Line Path"

Following the instructions I determined that I need to run the following two commands to complete this step:

$ export PATH=~/.local/bin:$PATH
$ source ~/.profile

once I do this I can run $ aws and I see the following message as expected:

usage: aws [options] <command> <subcommand> [<subcommand> ...] [parameters]
To see help text, you can run:

  aws help
  aws <command> help
  aws <command> <subcommand> help
aws: error: too few arguments

All good so far. If I close my terminal and then re-open a new terminal and I try to run an command starting with aws I get the following:

bash: aws: command not found

I have found that if I re-run the following...

$ export PATH=~/.local/bin:$PATH
$ source ~/.profile

... then it works again... until I close my terminal window.

So my question is:

Is this expected behavior, to have to re run these commands every time I want to work with the AWSCLI? Or should this step be a do-once-and-done. I admit I don't know very much about the nature of these commands, or what they are trying to achieve.

WillD
  • 5,170
  • 6
  • 27
  • 56

1 Answers1

3

This is expected behaviour of export and source. You will find yourself doing the same thing for other programs as well, not just aws-cli.

A better way would be to edit the ~/.profile file and add export PATH=~/.local/bin:$PATH at the end of file.

Every time you open a new shell session, the .profile file is loaded, and the export will be run.

Rocode
  • 108
  • 6