Gathering detailed insights and metrics for serverless-prune-plugin
Gathering detailed insights and metrics for serverless-prune-plugin
Gathering detailed insights and metrics for serverless-prune-plugin
Gathering detailed insights and metrics for serverless-prune-plugin
Serverless Framework plugin to reap unused versions of deployed functions from AWS
npm install serverless-prune-plugin
61.8
Supply Chain
97.8
Quality
78.6
Maintenance
100
Vulnerability
98.3
License
Module System
Min. Node Version
Typescript Support
Node Version
NPM Version
364 Stars
117 Commits
35 Forks
9 Watching
2 Branches
11 Contributors
Updated on 19 Nov 2024
JavaScript (100%)
Cumulative downloads
Total Downloads
Last day
-4.1%
55,676
Compared to previous day
Last week
2.8%
301,440
Compared to previous week
Last month
7.4%
1,260,881
Compared to previous month
Last year
1.2%
14,740,017
Compared to previous year
1
1
Following deployment, the Serverless Framework does not purge previous versions of functions from AWS, so the number of deployed versions can grow out of hand rather quickly. This plugin allows pruning of all but the most recent version(s) of managed functions from AWS. This plugin is compatible with Serverless 1.x and higher.
Install with npm:
1npm install --save-dev serverless-prune-plugin
And then add the plugin to your serverless.yml
file:
1plugins: 2 - serverless-prune-plugin
Alternatively, install with the Serverless plugin command (Serverless Framework 1.22 or higher):
1sls plugin install -n serverless-prune-plugin
In the project root, run:
1sls prune -n <number of version to keep>
This will delete all but the n
-most recent versions of each function deployed. Versions referenced by an alias are automatically preserved.
A single function can be targeted for cleanup:
1sls prune -n <number of version to keep> -f helloWorld
The previous usage examples prune the default stage in the default region. Use --stage
and --region
to specify:
1sls prune -n <number of version to keep> --stage production --region eu-central-1
This plugin can also be configured to run automatically, following a deployment. Configuration of automatic pruning is within the custom
property of serverless.yml
. For example:
1custom: 2 prune: 3 automatic: true 4 number: 3
To run automatically, the automatic
property of prune
must be set to true
and the number
of versions to keep must be specified.
It is possible to set number
to 0
. In this case, the plugin will delete all the function versions (except $LATEST); this is useful when disabling function versioning for an already-deployed stack.
This plugin can also prune Lambda Layers in the same manner that it prunes functions. You can specify a Lambda Layer, or add the flag, includeLayers
:
1custom: 2 prune: 3 automatic: true 4 includeLayers: true 5 number: 3
A dry-run will preview the deletion candidates, without actually performing the pruning operations:
1sls prune -n <number of version to keep> --dryRun
See:
1sls prune --help
To run this plugin, the user will need to be allowed the following permissions in AWS:
lambda:listAliases
lambda:listVersionsByFunction
lambda:deleteFunction
lambda:listLayerVersions
lambda:deleteLayerVersion
How do I set up different pruning configurations per region/stage?
Several suggestions are available in this thread.
Can I just disable versioning entirely?
Absolutely. While Serverless Framework has it enabled by default, versioning can be disabled.
Copyright (c) 2017 Clay Gregory. See the included LICENSE for rights and limitations under the terms of the MIT license.
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
no dangerous workflow patterns detected
Reason
license file detected
Details
Reason
10 commit(s) and 1 issue activity found in the last 90 days -- score normalized to 9
Reason
dependency not pinned by hash detected -- score normalized to 5
Details
Reason
5 existing vulnerabilities detected
Details
Reason
Found 1/9 approved changesets -- score normalized to 1
Reason
detected GitHub workflow tokens with excessive permissions
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Score
Last Scanned on 2024-11-25
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More