Configuration of AWS function version backlog (version history)
See original GitHub issueThis is a Feature Proposal
Description
Currently the function versions deployed by Serverless will be retained forever. For some use cases it is good to have some old versions available (e.g. blue/green deplyoment), but keeping every version will clutter the version history.
As there are as many different uses as there are different users, it would be great if the version backlog could be configured at everyone’s will. Currently the versioning can only be disabled completely by setting versionFunctions
to false
.
This discussion originated in Gitter, so I’ll put the snippets together, that should compose a good starting point for a discussion or even provides a feasible solution.
Proposal
We could extend the semantics of the versionFunctions
property and add an additional property to specify the size of the version backlog (in case the user wants to keep versions).
versionFunctions: false | 'delete' | 'retain'
retainVersions: number (defaults to all)
The versionFunctions values would mean the following:
false
: Disable versioning, exactly the same as now when set to false
delete
: Delete old versions (tech. set DeletionPolicy to Delete
in the CF AWS::Lambda::Version resource). CF manages the deletion.
retain
: Retain old versions (tech. set DeletionPolicy to Retain
as it is now). SLS manages the version retention. If the retainVersions
property is set to a positive integer, that amount of old versions will be kept. If not set, no versions will be deleted at all.
retain
must be the default if not specified, because that matches the current behavior and won’t lead to breaking changes.
Samples
Retain the 5 last versions:
versionFunctions: 'retain'
retainVersions: 5
Keep no versions:
versionFunctions: 'delete'
Keep all versions:
<nothing set> (backwards compatible)
or (explicitly)
versionFunctions: 'retain'
Issue Analytics
- State:
- Created 6 years ago
- Reactions:8
- Comments:6 (5 by maintainers)
Thanks, I know about that plugin. I mean - if there is already implemented
versionFunctions
inside Serverless, why notretainVersions
…I really like the proposal. If there’s an interest, it’ll be great to start with implementation spec (proposal on how to implement this feature internally). Having and agreeing on that PR would be welcome.