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
Best Way to Script Remote Ssh Commands in Batch (Windows)
Delete All Files Older Than 30 Days, Based on File Name as Date
Why No Output Is Shown When Using Grep Twice
How to Add a Line of Text to the Middle of a File Using Bash
Using Ls to List Directories and Their Total Sizes
How to Exclude Directories from Grep -R
How to Remove All .Svn Directories from My Application Directories
Maximum Number of Bash Arguments != Max Num Cp Arguments
Will Read() Ever Block After Select()
How to Get Amount of Queued Data for Udp Socket
Why Doesn't "Sort File1 > File1" Work
Return Code When Oom Killer Kills a Process
Linux Removing Folders Older Than 1 Year and More Than 3 Files
Linux Shell Script to Add Leading Zeros to File Names