12

this is probably not a big issue for most people but do you know if there is anywhere a portable version for windows of aws-cli.

This because some people might want to install it for example in company laptops and not have admin rights to do it so I was wondering if I could find a portable version somewhere.


edit

could not find a proper portable software version for it but if you manage to install python and use pip then the installation following the instructions in github are quite easy.

final update

I was quite lucky because my company just introduced python as a tool that they allow us to install so I managed to use pip. the only thing I needed to consider was the user flag so it installs where I have permissions:

pip install --user awscli
pip install --target=YOUR_PATH awscli
Miguel Costa
  • 627
  • 1
  • 12
  • 30
  • "portable" as in 'does not need to be installed/can run from a thumb drive/etc.' ? – underscore_d Jan 09 '18 at 10:37
  • 1
    yes that is normally the definition of portable no? :) i took a look at the github project actually but not sure i know how to build it on my windows machine, but that might be my next option, mainly i might be able to compile it just not sure about the configs – Miguel Costa Jan 10 '18 at 04:01
  • 1
    found out that once I installed pip was quite easy to get this from the repository so I guess this is not really needed – Miguel Costa Jan 10 '18 at 10:03
  • Assuming you'll always have Python. You could also use `boto3` in a virtualenv. – OneCricketeer Jan 30 '18 at 05:37

4 Answers4

12

As of April 2021, there is only awscli version 1 available in pip repositories. If you want to use awscli version 2 but you don't want to use chocolatey or you don't have another windows machine available, you can:

msiexec /a %USERPROFILE%\Downloads\AWSCLIV2.msi /qb TARGETDIR=%USERPROFILE%\awscli

Now you can use awscli version 2 using the following command:

>%USERPROFILE%\awscliv2\Amazon\AWSCLIV2\aws --version
aws-cli/2.1.39 Python/3.8.8 Windows/10 exe/AMD64 prompt/off

As this method is a workaround, an feature request has been raised to be able to install awscli without admin rights: https://github.com/aws/aws-cli/issues/4633

Vincent Doba
  • 4,343
  • 3
  • 22
  • 42
  • I did this, it looked like it installed correctly, but when I use the command posted above it doesn't output anything. Can you elaborate on how to run the awscliv2? – j7skov Nov 01 '21 at 13:09
  • Do you have an `aws` file present when you list files in `%USERPROFILE%\awscliv2\Amazon\AWSCLIV2` directory ? You can do this with `dir %USERPROFILE%\awscliv2\Amazon\AWSCLIV2` command. If there is an `aws` file in this directory, you have successfully extracted awscli v2 application. If so, did you execute the right command, you should remove the `>` prefix from command and execute `%USERPROFILE%\awscliv2\Amazon\AWSCLIV2\aws --version` command. – Vincent Doba Nov 01 '21 at 21:20
  • looks like I was using awscliv2/Amazon/...etc for the top level folder instead of awscli/Amazon/...etc. May want to amend your answer as I just followed all the directions verbatim. But its working now, thanks! – j7skov Nov 03 '21 at 12:43
  • 1
    One last thing: you can use PowerShell's Set-Alias to get this to work as the regular aws command (like Linux): `Set-Alias -Name aws -Value "%USERPROFILE%/awscli/Amazon/AWSCLIV2/aws"` – j7skov Nov 03 '21 at 12:48
  • Great hint, @j7skov! But, in Powershell, maybe you have to replace `%USERPROFILE%` with `~`? – Charles Roberto Canato Dec 24 '21 at 07:22
  • @Charles - I had to use %USERPROFILE% because I installed aws on my C: drive in windows. – j7skov Dec 25 '21 at 18:27
6

This is how I've gotten around this issue in the past:

I downloaded (.msi) and install AWS CLI onto my personal laptop then I copy this entire directory (/Amazon/AWSCLI/..) to my corporate laptop where I don't have Admin rights. Then you can either temporarily update the PATH environment variable in your cmd/powershell session or you can permanently update your user variable's PATH to include the location of aws.exe.

It appears you will have to use the aws.exe under /bincompat (instead of /bin) as of their newest release. I haven't yet tested this version to see what limitation exists.

Quickmute
  • 1,583
  • 1
  • 11
  • 7
1

I'm not sure what 'Portable' level you're expecting, but you may find these resources helpful Chocolatey AWS Tools etc..

Or if you are using Docker Create a Docker image for the Amazon Web Services CLI that provides a portable, contained experience.

Aaron Chu
  • 19
  • 5
  • Docker for Windows requires Windows 10 Pro or Enterprise, though. Also, "company laptops" with strict installation processes probably don't allow Docker – OneCricketeer Jan 30 '18 at 05:34
  • i guess something like this might work (not the docker) but the choco or just do it with python. I was originally looking for a zip file, but after installing it I see that since it's so basic and lightweight that probably a portable version does not make sense – Miguel Costa Jan 31 '18 at 13:57
0

Have you tried it using pip? if you have python available then:

For python version > 3.7

$ python -m pip install awscli --user

$ aws

Note: AWS CLI version 2, the latest major version of the AWS CLI, is now stable and recommended for general use. For more information, see the AWS CLI version 2 installation instructions at: https://docs.aws.amazon.com/cli/latest/userguide/install-cliv2.html

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

  aws help
  aws <command> help
  aws <command> <subcommand> help
s510
  • 2,271
  • 11
  • 18