Skip to content

Scheduled Lambda function packaged with SAM which removes old Lambda versions

Notifications You must be signed in to change notification settings

rewindio/lambda-version-cleaner

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Lambda Version Cleaner

Purpose

This SAM template deploys a Lambda function that deletes old Lambda versions in the account deployed in.

Installing

There are deployment workflows that handle deployment on PR merge. If you want to install manually, everything is packaged with AWS SAM. Note that the AlarmsSNSTopic parameter is optional and if provided, will also deploy a CloudWatch alarm on invocation errors which pushes alarm events to the specified AlarmsSNSTopic. Clone this repo and run the following commands:

sam build --use-container

sam deploy --debug \                        
    --stack-name lambda-version-cleaner \
    --s3-bucket <an existing bucket to store lambda sam apps in> \
    --region <AWS region to deploy to> \
    --profile <AWS profile to use> \
    --capabilities CAPABILITY_NAMED_IAM \
    --parameter-overrides \
        "NumberOfVersionsToKeep=<number> \
        AWSRegions=<comma separated list of AWS regions to delete Lambda versions from> \
        AlarmsSNSTopic=<optional input name of alarm SNS topic>" \
    --no-fail-on-empty-changeset

e.g.
sam deploy --debug \                        
    --stack-name lambda-version-cleaner \
    --s3-bucket some-s3-bucket \
    --region us-east-1 \
    --profile staging \
    --capabilities CAPABILITY_NAMED_IAM \
    --parameter-overrides \
        "NumberOfVersionsToKeep=10  \
        AWSRegions=us-east-1,us-east-2" \
    --no-fail-on-empty-changeset

About

Scheduled Lambda function packaged with SAM which removes old Lambda versions

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages