0.5.0 • Published 7 years ago

aws-lambda-ecr-cleaner v0.5.0

Weekly downloads
3
License
MIT
Repository
github
Last release
7 years ago

aws-lambda-ecr-cleaner

Code Climate JavaScript Style Guide Coverage Status Build

An AWS Lambda Function to clean ecr repos automatically.

Requirements

  • node.js ( AWS Lambda working version is 4.3.2 )

Installation

Clone this repository and install dependencies:

$ git clone git@github.com:Puemos/aws-lambda-ecr-cleaner.git
$ cd aws-lambda-ecr-cleaner
$ npm install

Packaging

AWS Lambda accepts zip archived package. To create it, run npm run package task simply.

$ npm run package --packageDirectory=./dist

It will create aws-lambda-ecr-cleaner.zip at project root. You can upload it.

Configuration

Hardcode the configuration on config.json

Use AWS Environment Variables

NameTypeDescriptionDefault
DRY_RUNBoolRun without deletetrue
API_DELAYIntegerDelay between calls500
REPO_AGE_THRESHOLDIntegerImage age threshold90
REPO_FIRST_N_THRESHOLDIntegerHow many images from each group to keep3
AWS_ACCOUNT_IDIntegerThe account id number
REGIONStringECR and ECS region.us-east-1
REPO_TO_CLEANString / Array StringOne repo name or an array of repos name to clean
ENVSArray StringGroup by these strings and one for each unique tag

License

MIT License @ Shy Alter

Credits