I have around 200 lambda functions that I need to delete. Using the console I can only delete one at a time, which would be really painful. Does anyone know a cli command to bulk delete all the functions? Thanks!
2 Answers
I've just found an answer using an old script to delete IAM users I had:
aws lambda list-functions --region us-east-1 | jq -r '.Functions | .[] | .FunctionName' |
while read uname1; do
echo "Deleting $uname1";
aws lambda delete-function --region us-east-1 --function-name $uname1;
done
1 Comment
johnny
Note: Had to
brew install jq to run this on MacOSA one-liner without having to use jq:
$ region="us-east-1"
$ aws lambda list-functions --region "${region}" --query 'Functions[].FunctionName' --output text | tr "\t" "\n" | xargs -I {} aws lambda delete-function --region "${region}" --function-name {}
1 Comment
CortexCompiler
I definitely prefer this one-liner and like using the built-in
--query option too.