There are several ways to delete a version of a lambda function. All the followings have the same effect. See the manual for details.
With the function name followed by the version
aws lambda delete-function --function-name ${FUNCTION_NAME}:${VERSION}
Example:
aws lambda delete-function --function-name my-function:1
With the function name and the qualifier option
aws lambda delete-function --function-name ${FUNCTION_NAME} --qualifier ${VERSION}
Example:
aws lambda delete-function --function-name my-function --qualifier 1
With the function ARN followed by the version
aws lambda delete-function --function-name ${FUNCTION_ARN}:${VERSION}
Example:
aws lambda delete-function --function-name arn:aws:lambda:us-west-2:123456789012:function:my-function:1
With the function ARN and the qualifier option
aws lambda delete-function --function-name ${FUNCTION_ARN} --qualifier ${VERSION}
Example:
aws lambda delete-function --function-name arn:aws:lambda:us-west-2:123456789012:function:my-function --qualifier 1
Notes
- You will get no message when the command finishes sucessfully, because the API DeleteFunction responds with 204 No Content.
- The command is successful, even if the specified version does not exist. I don't think this is a good behavior. The API reference says that it responds with 404 if the resource specified in the request does not exist.