Created
July 22, 2019 12:10
-
-
Save reegz/96d552b348fd5f8f4d7bfc3556e9ca98 to your computer and use it in GitHub Desktop.
Quick bash script to sequentially download AWS Lambda functions linked to the current AWS profile. Relies on the output format being in JSON.
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/sh | |
## List the names of all Lambda functions. Can be constrained by using --max-items | |
for i in `aws lambda list-functions | grep FunctionName | cut -d ":" -f2 | cut -d '"' -f2` | |
do | |
echo 'Fetching code for function:' $i | |
## Using each name, get the function details and then download the zip file containing the source code. | |
aws lambda get-function --function-name $i | grep Location | awk -F' ' '{print $2}' | xargs wget -O $i.zip | |
echo 'Code downloaded to' $i.zip | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment