Skip to content

Commit 77f8bec

Browse files
committed
add documentation and update libraries
1 parent 679604f commit 77f8bec

File tree

3 files changed

+1909
-1762
lines changed

3 files changed

+1909
-1762
lines changed

README.md

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,4 +29,58 @@
2929

3030
# Serverless prune versions
3131

32+
1. [Overview](#overview)
33+
1. [Installation and setup](#installation-and-setup)
34+
1. [Configuration](#configuration)
35+
36+
_Feedback appreciated! If you have an idea for how this plugin can be improved [please open an issue](https://github.com/manwaring/serverless-prune-versions/issues/new)._
37+
38+
# Overview
39+
40+
This plugin for the Serverless Framework removes old versions of AWS Lambda functions - important because if left to it's own devices each time the Serverless Framework is used to update your Lambda or Lambda Layer code in AWS it creates a new version. But if you aren't using the old versions then no harm, no foul - right? Unfortunately not, because for each and every version that's created AWS Lambda stores the source code used by that version for you - and there's a hard limit of only 75GB available per account for storage of this source code. By removing old versions this plugin keeps you from hitting this storage limit, letting you worry about features instead of account limits.
41+
42+
# Installation and setup
43+
44+
Install the plugin as a dev dependency in your project
45+
46+
`npm i -D serverless-prune-versions` or `yarn add serverless-prune-versions`
47+
48+
Add the plugin to the `plugins` block of your `serverless.yml` file
49+
50+
```yml
51+
plugins:
52+
- serverless-prune-versions
53+
```
54+
55+
# Configuration
56+
57+
Because this plugin will delete deployed versions of your Lambda functions it is disabled by default and you must explicitly enable it.
58+
59+
This plugin uses the following default configuration
60+
61+
| Property | Description | Default value |
62+
| -------------- | ---------------------------------------------------------------------------------- | ------------- |
63+
| Automatic | Boolean, should plugin run automatically post-deployment | `false` |
64+
| Include Layers | Boolean, should plugin remove Lambda Layer versions in addition to Lambda versions | `false` |
65+
| Number | Numeric, how many versions to retain | `5` |
66+
67+
68+
All properties can be changed by overriding values in the `custom` block of your `serverless.yml`. In this example the plugin will automatically run after every deployment and will remove all Lambda and Lambda Layers except for the 3 most recent.
69+
70+
```yml
71+
custom:
72+
prune:
73+
automatic: true
74+
includeLayers: true
75+
number: 3
76+
```
77+
78+
This is the minimal configuration needed for the plugin to run automatically after every deployment - it will only remove Lambda versions (not Lambda Layer versions) and will retain the last 5 versions since those defaults weren't overriden.
79+
80+
```yml
81+
custom:
82+
prune:
83+
automatic: true
84+
```
85+
3286
<img height="0" src="https://b7z7o7y5fi.execute-api.us-east-1.amazonaws.com/v1/readme/visits/github/manwaring/serverless-prune-versions?style=flat-square">

0 commit comments

Comments
 (0)