ABC XYZ
ABC XYZ

Reputation: 101

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?

Upvotes: 8

Views: 6508

Answers (1)

Ermiya Eskandary
Ermiya Eskandary

Reputation: 23592

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

Upvotes: 16

Related Questions