All Projects β†’ claygregory β†’ Serverless Prune Plugin

claygregory / Serverless Prune Plugin

Licence: mit
Serverless plugin to reap unused versions of deployed functions from AWS

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to Serverless Prune Plugin

Serverless Chrome
🌐 Run headless Chrome/Chromium on AWS Lambda
Stars: ✭ 2,625 (+980.25%)
Mutual labels:  serverless, aws-lambda, serverless-framework
Serverless Sam
Serverless framework plugin to export AWS SAM templates for a service
Stars: ✭ 143 (-41.15%)
Mutual labels:  serverless, aws-lambda, serverless-framework
Serverless
Serverless ζžΆζž„εΊ”η”¨εΌ€ε‘ζŒ‡ε— - Serverless Architecture Application Development Guide with Serverless Framework.
Stars: ✭ 1,616 (+565.02%)
Mutual labels:  serverless, aws-lambda, serverless-framework
Aws Lambda Typescript
This sample uses the Serverless Application Framework to implement an AWS Lambda function in TypeScript, deploy it via CloudFormation, publish it through API Gateway to a custom domain registered on Route53, and document it with Swagger.
Stars: ✭ 228 (-6.17%)
Mutual labels:  serverless, aws-lambda, serverless-framework
Formplug Serverless
Form forwarding service for AWS Lambda
Stars: ✭ 232 (-4.53%)
Mutual labels:  serverless, aws-lambda, serverless-framework
Serverless Side Rendering React Next
Sample repo for setting up Next and React on AWS Lambda with the Serverless Framework.
Stars: ✭ 117 (-51.85%)
Mutual labels:  serverless, aws-lambda, serverless-framework
Retinal
πŸ™ Retinal is a Serverless AWS Lambda service for resizing images on-demand or event-triggered
Stars: ✭ 208 (-14.4%)
Mutual labels:  serverless, aws-lambda, serverless-framework
Serverless With Next5 Boilerplate
Serverless.js with Next.js 5 on AWS, powered by the Serverless Framework
Stars: ✭ 100 (-58.85%)
Mutual labels:  serverless, aws-lambda, serverless-framework
Zappa
Serverless Python
Stars: ✭ 11,859 (+4780.25%)
Mutual labels:  serverless, aws-lambda, serverless-framework
Serverless Next.js
⚑ Deploy your Next.js apps on AWS Lambda@Edge via Serverless Components
Stars: ✭ 2,977 (+1125.1%)
Mutual labels:  serverless, aws-lambda, serverless-framework
Serverless Docker Image Resize
Simple serverless image resize on-the-fly - Deploy with one command - Built with AWS Lambda and S3
Stars: ✭ 114 (-53.09%)
Mutual labels:  serverless, aws-lambda, serverless-framework
Serverless Aws Alias
Alias support for Serverless 1.x
Stars: ✭ 171 (-29.63%)
Mutual labels:  serverless, aws-lambda, serverless-framework
Awesome Layers
Ξ» A curated list of awesome AWS Lambda Layers. Sponsored by https://cloudash.dev
Stars: ✭ 1,655 (+581.07%)
Mutual labels:  serverless, aws-lambda, serverless-framework
Serverless Architectures Aws
The code repository for the Serverless Architectures on AWS book
Stars: ✭ 120 (-50.62%)
Mutual labels:  serverless, aws-lambda, serverless-framework
Serverless
⚑ Serverless Framework – Build web, mobile and IoT applications with serverless architectures using AWS Lambda, Azure Functions, Google CloudFunctions & more! –
Stars: ✭ 41,584 (+17012.76%)
Mutual labels:  serverless, aws-lambda, serverless-framework
A Crash Course On Serverless Auth
A short and easy boilerplate showcasing JWT auth with Nodejs, the Serverless framework, MongoDB and AWS Lambda.
Stars: ✭ 127 (-47.74%)
Mutual labels:  serverless, aws-lambda, serverless-framework
Serverless Plugin Git Variables
⚑️ Expose git variables to serverless
Stars: ✭ 75 (-69.14%)
Mutual labels:  serverless, aws-lambda, serverless-framework
Kinesis Streams Fan Out Kinesis Analytics
Amazon Kinesis Streams fan-out via Kinesis Analytics (powered by the Serverless Framework)
Stars: ✭ 95 (-60.91%)
Mutual labels:  serverless, aws-lambda, serverless-framework
Serverless Sentry Plugin
This plugin adds automatic forwarding of errors and exceptions to Sentry (https://sentry.io) and Serverless (https://serverless.com)
Stars: ✭ 146 (-39.92%)
Mutual labels:  serverless, aws-lambda, serverless-framework
Cartoonify
Deploy and scale serverless machine learning app - in 4 steps.
Stars: ✭ 157 (-35.39%)
Mutual labels:  serverless, aws-lambda, serverless-framework

Serverless Prune Plugin

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.

Serverless Build Status Coverage Status

Installation

Install with npm:

npm install --save-dev serverless-prune-plugin

And then add the plugin to your serverless.yml file:

plugins:
  - serverless-prune-plugin

Alternatively, install with the Serverless plugin command (Serverless Framework 1.22 or higher):

sls plugin install -n serverless-prune-plugin

Usage

In the project root, run:

sls 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.

Single Function

A single function can be targeted for cleanup:

sls prune -n <number of version to keep> -f helloWorld

Region/Stage

The previous usage examples prune the default stage in the default region. Use --stage and --region to specify:

sls prune -n <number of version to keep> --stage production --region eu-central-1

Automatic Pruning

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:

custom:
  prune:
    automatic: true
    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.

Layers

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:

custom:
  prune:
    automatic: true
    includeLayers: true
    number: 3

Dry Run

A dry-run will preview the deletion candidates, without actually performing the pruning operations:

sls prune -n <number of version to keep> --dryRun

Additional Help

See:

sls prune --help

Permissions Required

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

Common Questions

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.

License

Copyright (c) 2017 Clay Gregory. See the included LICENSE for rights and limitations under the terms of the MIT license.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].