How to Upgrade Aws Cli to the Latest Version

How to upgrade AWS CLI to the latest version?

From http://docs.aws.amazon.com/cli/latest/userguide/installing.html#install-with-pip

To upgrade an existing AWS CLI installation, use the --upgrade option:

pip install --upgrade awscli

How to get latest version of SAM-CLI on windows

Problem was i somehow installed 2 versions of sam-cli. I just deleted both from C:\Program Files\Amazon and reinstalled using msi from https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/serverless-sam-cli-install-windows.html.

After this i was getting command not found when running

sam --version

Finally found that

sam.cmd --version 

worked as expected.

change the AWS CLI from 1 to 2

I removed my old aws cli from ~/.pyenv/versions/x.x.x/bin/aws, where x.x.x is the current Python version.

Get the current version:

$ pyenv versions
* 3.7.4

Remove aws cli from current pyenv bin:

$ rm -rf ~/.pyenv/versions/3.7.4/bin/aws*

Try again which aws:

$ which aws 
/usr/local/bin/aws

How to parse aws cli output using jq

You can actually use JMESPATH in the AWS CLI without needing to use jq:

aws elbv2 describe-target-group-attributes \
--target-group-arn arn:aws:elasticloadbalancing:us-west-2:123456789012:targetgroup/my-targets/73e2d6bc24d8a067 \
--query "Attributes[?Key=='deregistration_delay.timeout_seconds']|[0].Value" \
--output text

JMESPATH was created by James Saryerwinnie, one of the authors of the AWS CLI. The tutorial is well worth reading.

AWS S3 LS --include: Unknown options

You can easily build the desired functionality by piping the result of the aws cli command to grep or similar.


In Bash:

Here's an example which mirrors the "include" functionality:

$ aws s3 ls s3://bucket --recursive | grep ".*.txt.*"

Here's an example which mirrors the "exclude" functionality:

$ aws s3 ls s3://bucket --recursive | grep -v ".*.txt.*"

In Powershell:

Here's an example which mirrors the "include" functionality:

$ aws s3 ls s3://bucket --recursive | Select-String ".*.txt.*"

Here's an example which mirrors the "exclude" functionality:

$ aws s3 ls s3://bucket --recursive | Select-String ".*.txt.*" -NotMatch


Related Topics



Leave a reply



Submit