# purge-lambda-versions

> API to delete old AWS Lambda versions

Latest version **1.0.5** (published 2022-06-16) · ISC license · 0 weekly downloads

## Install

```sh
npm install purge-lambda-versions
pnpm add purge-lambda-versions
yarn add purge-lambda-versions
bun add purge-lambda-versions
```

Provides the command `plv`.

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.5 |
| Published | 2022-06-16 |
| First published | 2022-06-16 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Unpacked size | 28.1 KB |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 0 |
| Author | paulodrade |
| Maintainers | paulodrade |
| Keywords | aws, lambda, lambda, versions |

## Links

- npm: https://www.npmjs.com/package/purge-lambda-versions
- Repository: https://github.com/paulodrade/purge-lambda-versions
- Homepage: https://github.com/paulodrade/purge-lambda-versions#readme
- Issues: https://github.com/paulodrade/purge-lambda-versions/issues
- npm.io page: https://npm.io/package/purge-lambda-versions

## Dependencies (2)

- [async](https://npm.io/package/async.md) ^3.2.4
- [aws-sdk](https://npm.io/package/aws-sdk.md) ^2.1156.0

## Alternatives

- [@opentelemetry/exporter-zipkin](https://npm.io/package/@opentelemetry/exporter-zipkin.md) — 14.8M weekly downloads
- [pusher-js](https://npm.io/package/pusher-js.md) — 2.0M weekly downloads
- [browserify](https://npm.io/package/browserify.md) — 1.7M weekly downloads
- [sqs-consumer](https://npm.io/package/sqs-consumer.md) — 1.7M weekly downloads
- [@sanity/eventsource](https://npm.io/package/@sanity/eventsource.md) — 930.8K weekly downloads

## Recent versions

- 1.0.5 (latest) — 2022-06-16
- 1.0.2 — 2022-06-16
- 1.0.1 — 2022-06-16
- 1.0.0 — 2022-06-16

## README

# purge-lambda-versions
A package to delete old AWS lambda versions.

## Installation

```bash
npm install purge-lambda-versions --save-dev
```

## Usage as API
```node
const { PLV } = require('purge-lambda-versions');

const plv = new PLV({
  KEEP_VERSIONS: '{KEEP_VERSIONS}', // [optional] default: 10
  AWS_REGION: '{AWS_REGION}', // [optional] default: 'us-east-1'
  AWS_ACCESS_KEY_ID: '{AWS_ACCESS_KEY_ID}', // optional if already shell authenticated
  AWS_SECRET_ACCESS_KEY: '{AWS_SECRET_ACCESS_KEY}' // optional if already shell authenticated
});

plv.clearFunctions([
  {
    FUNCTION_NAME: 'lambda-function-name-1'
  },
  {
    FUNCTION_NAME: 'lambda-function-name-2'
  }
]).then(
  () => {
    // ALL DONE
  }, 
  error => {
    // ERROR
  }
);

// you can also provided set the number of versions to provide by function
plv.clearFunctions([
  {
    FUNCTION_NAME: 'lambda-function-name-1';
    KEEP_VERSIONS: 20
  },
  {
    FUNCTION_NAME: 'lambda-function-name-2';
    KEEP_VERSIONS: 50
  }
]).then(
  () => {
    // ALL DONE
  }, 
  error => {
    // ERROR
  }
);
```

## Usage as command line

```bash
plv 
  --functions lambda-function-name # you can pass multiple function names separated with comma (DO NOT PUT SPACES BETWEEN FUNCTION NAMES)
  --keep_versions 10 # [optional] default: 10
  --aws_region us-east-1 # [optional] default: us-east-1
  --aws_access_key_id your-key # not required of already authenticated within terminal
  --aws_secret_key your-secret-key # not required of already authenticated within terminal
```

## IMPORTANT
The script DO NOT delete the `$LATEST` version, neither versions binded to `alias`.

## Contributing
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

## License
[MIT](https://choosealicense.com/licenses/mit/)

---
_Source: https://npm.io/package/purge-lambda-versions · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
