AWS CLI 2 for Exporting Lambdas

https://gist.github.com/TheNetJedi/0847ba0ec1da9879b4fa1d8f3276b004

Export all lambda functions to lambdafunctions directory as indivudual zip files. Be sure to update the region, currently set to us-east-1
This works great in AWS CloudShell

 

mkdir lambdafunctions
aws lambda --profile kickpost list-functions | \
grep FunctionName | \
cut -d '"' -f4 | \
while read -r name; do
# aws lambda --profile kickpost get-function --function-name $name | tail -n 3 | egrep -o 'https?://[^ ]+' | sed 's/"//' | xargs wget -O ./lambdafunctions/$name.zip
aws lambda --profile kickpost get-function --function-name $name | tee ./lambdafunctions/$name.json | jq -r '.Code.Location' | xargs wget -O ./lambdafunctions/$name.zip
done

# https://awscli.amazonaws.com/v2/documentation/api/latest/reference/lambda/get-function.html
# https://gist.github.com/TheNetJedi/0847ba0ec1da9879b4fa1d8f3276b004