Skip to content

Instantly share code, notes, and snippets.

@kmiyabbm
Created April 18, 2019 09:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kmiyabbm/aab625efbb16c34a6b4ad65b60bc55c8 to your computer and use it in GitHub Desktop.
Save kmiyabbm/aab625efbb16c34a6b4ad65b60bc55c8 to your computer and use it in GitHub Desktop.
AWSアカウント内の全リージョンのLambda関数のリストを出力するスクリプト
#!/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