Skip to content

Instantly share code, notes, and snippets.

@jankei
Created January 5, 2016 19:17
Show Gist options
  • Save jankei/2085f55de1d70e339fad to your computer and use it in GitHub Desktop.
Save jankei/2085f55de1d70e339fad to your computer and use it in GitHub Desktop.
deletes old versions of lambdas that aren't aliased
#!/bin/bash
for (( i=1; i<=$2; i++ ))
do
aws lambda delete-function --function-name $1 --qualifier $i &>/dev/null
echo "lambda $1 version $i was deleted"
done
@jaga-me
Copy link

jaga-me commented Jul 5, 2018

`#!/bin/bash
fnlist=(
'SAMPLE FUNCTION'

Add more functions here

)

count=0
while [ "x${fnlist[count]}" != "x" ]
do
for (( i=1; i<=$1; i++ ))
do
aws lambda delete-function --function-name ${fnlist[count]} --qualifier $i
echo "lambda ${fnlist[count]} version $i was deleted"
done
count=$(( $count + 1 ))
done
`

@jaga-me
Copy link

jaga-me commented Jul 5, 2018

sorry about the formatting. i did a bit more to allow for the deletion of multiple functions as a loop

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment