Delete all your lambda functions

For some reason I wanted to delete every Lambda function I had, in every region available.

Here’s how I actually typed it out.

while read -ra regionName; do while read -ra functionName; do aws lambda delete-function --region "$regionName" --function-name "$functionName"; done < <(aws lambda list-functions --function-version ALL --region "$regionName" | jq -r '.Functions[].FunctionName' | sort -u); done < <(aws account list-regions | jq -r '.Regions[] | select(.RegionOptStatus!="DISABLED").RegionName' | sort -u)

Here it is a bit cleaner for people who aren’t autistic.

while read -ra regionName; do
  while read -ra functionName; do
    aws lambda delete-function --region "$regionName" --function-name "$functionName"
  done < <(aws lambda list-functions --function-version ALL --region "$regionName" | jq -r '.Functions[].FunctionName' | sort -u)
done < <(aws account list-regions | jq -r '.Regions[] | select(.RegionOptStatus!="DISABLED").RegionName' | sort -u)

See also