Using Console
Using CLI
<function-name>
with the name of the function and <version>
with the version number of the function you want to delete.
Note: You should keep at least the latest version of the function.
Using Python
list_versions_by_function
method. If there are more than 10 versions, it deletes the oldest versions using the delete_function
method.You can schedule this script to run periodically using a Lambda function or a cron job to ensure that the number of versions of your Lambda functions stays within a manageable limit.