Download all of your Lambda functions from AWS using this Windows PowerShell script
function MyLambdaDownloaderFunction{
param ([Parameter(Mandatory = $true)] [String] $FunctionName)
Write-Output "Downloading $FunctionName..."
$loc = aws lambda get-function --function-name $FunctionName --query 'Code.Location'
$loc = ($loc -replace '"', "")
Invoke-WebRequest -Uri $loc -OutFile .\lambda_functions\$FunctionName.zip
}
mkdir -p lambda_functions
$a = aws lambda list-functions
$b = $a -split "`r`n" | Select-String -Pattern '(?<="FunctionName": ")[-\w]+'
$c = $b.Matches | Select-Object -Property "Value"
foreach ($funcName in $c) {
MyLambdaDownloaderFunction -FunctionName $funcName.Value
}
Write-Output "Completed Downloading all the Lamdba Functions!"
Leave a Reply