# ec2snapshots

> A utility for creating snapshots, and removing them after a retention period defined in volume tags

Latest version **0.0.2** (published 2018-01-07) · MIT license · 0 weekly downloads

## Install

```sh
npm install ec2snapshots
pnpm add ec2snapshots
yarn add ec2snapshots
bun add ec2snapshots
```

Provides the command `ec2snapshots`.

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.2 |
| Published | 2018-01-07 |
| First published | 2015-12-19 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 4 |
| Known vulnerabilities | 0 (+2 in 1 direct dependencies) |
| Install scripts | no |
| Author | Mike Milano |
| Maintainers | coder1 |

## Links

- npm: https://www.npmjs.com/package/ec2snapshots
- npm.io page: https://npm.io/package/ec2snapshots

## Dependencies (4)

- [async](https://npm.io/package/async.md) ^1.5.0
- [moment](https://npm.io/package/moment.md) ^2.10.6
- [aws-sdk](https://npm.io/package/aws-sdk.md) ~2.2.24
- [commander](https://npm.io/package/commander.md) ^2.9.0

## Recent versions

- 0.0.2 (latest) — 2018-01-07
- 0.0.1 — 2015-12-19
- 0.0.0 — 2015-12-19

## README

# ec2snapshots

This is a utility which creates snapshots and purges them after a set number of retention days
defined in AWS volume tags.

Each time the script is run, it will do the following for each volume which contains a `Snapshot` tag:
 - Purge snapshots older than the retention period (number of days defined as the value in the tag)
 - Create a new snapshot (Description format: [volume-id]_[volume-name]_YYYYMMDDHHSS)
 

## Installation

### 1) Install ec2snapshots

```
npm install -g ec2snapshots
```

### 2) Add your credentials to `~/.aws/credentials`

```
[default]
aws_access_key_id = XXXXXXXXXXXXXXXXXXXX
aws_secret_access_key = xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
```

Note: This project uses the AWS SDK for NodeJS. https://aws.amazon.com/sdk-for-node-js/

For more information on generating credentials, see: https://docs.aws.amazon.com/sdk-for-javascript/v2/developer-guide/getting-your-credentials.html

### 3) Tag the AWS volumes you would like to manage

Use the key name of `Snapshot` and add a value representing the number of days you would like the snapshot to be retained.

For example, if you would like a snapshot to be retained for 10 days, add a tag with a key name
of `Snapshot` and a value of `10`.


## Run it

```
ec2snapshots <region>
```

Separate multiple regions by commas.

```
ec2snapshots us-west-1,us-west-2
```

### Dry runs

If you would like to see what would happen, without creating or deleting any snapshots,
you can use the `--dryrun` flag.

```
ec2snapshots --dryrun us-west-1
# OR
ec2snapshots -d us-west-1
```


## Development

If you want to develop with the source, you can simply execute `./bin/ec2snapshots.js us-west-1` to test it.

If you would like to install it globally, based on your source, run the following from the project directory:

```
npm install . -g
```

This will replace the `ec2snapshots` executable with the latest from your current codebase.

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