serverless-application-model icon indicating copy to clipboard operation
serverless-application-model copied to clipboard

Add policy item of retaining only specified latest versions of lambdas

Open zafarella opened this issue 5 years ago • 2 comments

Describe your idea/feature/enhancement

  • the SAM template should have an item policy on how many versions of the lambda should be retained (last versions). Could be further feature rich like keeping only specific versions.

Proposal

  • Adding section in the Resources should be appropriate way to go imho. Something like:
Resources:
  RetainVersions:4

Additional Details

This would help save a lot space for large companies who does not use some abstraction on top of lambdas.

zafarella avatar Sep 17 '19 16:09 zafarella

@zafarella Thanks for the request. Since this is Spec specific, I am going to forward this to that repo.

jfuss avatar Sep 17 '19 16:09 jfuss

@zafarella Thanks a lot for the suggestion! We'll pass this along for prioritization. However, I wanted to let you know that there's an app called lambda-janitor in the AWS Serverless Application Repository that can be deployed into your account with just a few clicks and will automatically clean up old Lambda function versions. One advantage to using this app is that it cleans up all Lambda functions within the account/region it's deployed to, so you don't need to set a RetainVersions value on every function you define.

jlhood avatar Sep 17 '19 17:09 jlhood