Skip to content

Instantly share code, notes, and snippets.

View reegz's full-sized avatar
💭
Searching for lost code

Reegz reegz

💭
Searching for lost code
  • Johannesburg, South Africa
View GitHub Profile
@reegz
reegz / download-lambdas.sh
Created July 22, 2019 12:10
Quick bash script to sequentially download AWS Lambda functions linked to the current AWS profile. Relies on the output format being in JSON.
# !/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