Skip to main content

Limited Amount of Lambda versions

This rules concerns mostly Serverless framework users. Every time you deploy a lambda with the serverless framework, a new version is created and uploaded on an S3. On the other hand AWS has a quota of 75GB of lambda code that can be stored per account.

On a stack the number of version can go up quite quickly and sometime cause a Limit Exceeded when trying to deploy. To save all these versions, you will consume unnecessary resources and run your CO2 consumption higher.

If you use CDK to deploy lambda code, by default, versions will overwrite each others. If you override the Retention Strategy, this error might pop on your stack.

How to fix the issue

sls-mentor checks if you have 5 versions or less for each lambda. To solve this you can:

  1. Disable Serverless default setting to not save all versions
  2. Prune regurlaly lambda versions using Serverless Prune Plugin for instance