Created
April 18, 2019 09:37
-
-
Save kmiyabbm/aab625efbb16c34a6b4ad65b60bc55c8 to your computer and use it in GitHub Desktop.
AWSアカウント内の全リージョンのLambda関数のリストを出力するスクリプト
This file contains 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
#!/bin/bash | |
CMDNAME=`basename $0` | |
if [ $# -gt 1 ]; then | |
echo "Usage: ${CMDNAME} [profile]" 1>&2 | |
exit 1 | |
fi | |
# 第1引数でプロファイル名が指定されていたら上書きする | |
PROFILE="default" | |
if [ $# -eq 1 ]; then | |
PROFILE=$1 | |
fi | |
# AWSのリージョンのリストを取得する | |
REGIONS=(`aws --profile ${PROFILE} ec2 describe-regions --query Regions[*].RegionName --output text`) | |
# リージョン毎にLambda関数のリストを出力する | |
for region in ${REGIONS[@]} | |
do | |
echo "[${region}]" | |
aws --profile ${PROFILE} lambda list-functions --output text --region ${region} --query 'Functions[*].[FunctionName, Runtime, LastModified, Description]' |sort |column -t -s "`printf '\t'`" | |
echo "---------------------" | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment