Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I delete specific Lambda versions using the AWS CLI?

I have a Lambda with 30 versions. I want to delete Lambda versions 1-25 inclusive.

How can I do this using the AWS CLI?

like image 383
ABC XYZ Avatar asked Jun 09 '26 19:06

ABC XYZ


1 Answers

This deletes all Lambda versions from 1 to 25.

It loops inclusively over the 1-25 range & executes aws lambda delete-function appending the version number to the function name, indicating the specific version to be deleted.

Substitute MyLambdaFunctionName for your function name.

functionName='MyLambdaFunctionName'
for i in {1..25}
do
    echo "Deleting $functionName version $i"
    aws lambda delete-function --function-name $functionName:$i
done
like image 123
Ermiya Eskandary Avatar answered Jun 12 '26 09:06

Ermiya Eskandary