Last active
October 10, 2020 21:06
-
-
Save wyllie/c15ee391eb75571bc7269ee4cc7fb88e to your computer and use it in GitHub Desktop.
AWS CLI tools to get a list of lambda layers
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env sh | |
# Need to have the aws cli tool and jq | |
# aws cli: https://docs.aws.amazon.com/cli/latest/userguide/ | |
# jq: https://stedolan.github.io/jq/ | |
AWS_CLI='/usr/local/bin/aws' | |
JQ_LOC='/usr/local/bin/jq' | |
usage() { | |
echo "Usage: $0 aws_account" 1>&2 | |
} | |
AWS_ACCOUNT='default' | |
if [[ $1 ]]; then | |
AWS_ACCOUNT=$1 | |
fi | |
if [[ -x $JQ_LOC && -x $AWS_CLI ]]; then | |
echo Lambda layers installed in $AWS_ACCOUNT | |
$AWS_CLI --profile=$AWS_ACCOUNT lambda list-layers | $JQ_LOC \ | |
'[.Layers[] | { | |
layer: .LayerName, | |
arn: .LatestMatchingVersion.LayerVersionArn, | |
release: .LatestMatchingVersion.Description | |
}]' | |
else | |
usage | |
exit 1 | |
fi | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment