# serverless-seed-plugin

> Serverless Framework Plugin which seeds the data for AWS resources

Latest version **0.4.0** (published 2022-01-31) · MIT license · 0 weekly downloads

## Install

```sh
npm install serverless-seed-plugin
pnpm add serverless-seed-plugin
yarn add serverless-seed-plugin
bun add serverless-seed-plugin
```

## 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.4.0 |
| Published | 2022-01-31 |
| First published | 2021-07-09 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=14 |
| Dependencies | 2 |
| Unpacked size | 180.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 2 |
| Author | Purple Technology |
| Maintainers | tomzaoral, xurban42, pjediny, fekecrad, jancervinka, pyrek, bsedlak |

## Links

- npm: https://www.npmjs.com/package/serverless-seed-plugin
- Repository: https://github.com/purple-technology/serverless-seed-plugin
- Homepage: https://github.com/purple-technology/serverless-seed-plugin#readme
- Issues: https://github.com/purple-technology/serverless-seed-plugin/issues
- npm.io page: https://npm.io/package/serverless-seed-plugin

## Dependencies (2)

- [bluebird](https://npm.io/package/bluebird.md) ^3.7.2
- [copy-dynamodb-table](https://npm.io/package/copy-dynamodb-table.md) ^2.2.1

## Recent versions

- 0.4.0 (latest) — 2022-01-31
- 0.3.2 — 2022-01-12
- 0.3.1 — 2022-01-11
- 0.3.0 — 2022-01-11
- 0.1.0 — 2021-07-09

## README

# serverless-seed-plugin

This plugin is still in WIP and non-stable.

[![CI Status Badge](https://circleci.com/gh/purple-technology/serverless-seed-plugin.svg?style=svg)](https://github.com/purple-technology/serverless-seed-plugin)

This plugin seeds the data for AWS resources.

## Supported resources

- `AWS::DynamoDB::Table`
- `AWS::Cognito::UserPool`
- `AWS::S3::Bucket`

## Install

```sh
$ npm install --save-dev serverless-seed-plugin
```

Add the plugin to your `serverless.yml` file.

```yml
plugins:
  - serverless-seed-plugin
```

## Usage

Set up `custom.seed.<resource>.<options>` in your `serverless.yml` file. You can also follow the code in [./example/](./example) dir.

Then run `serverless seed`.

### DynamoDB

```yml
custom:
  seed:
    dynamodb:
      TableId:
        emptyOnly: true # default false - seed only if target is empty
        truncate: true # default false
        clone:
          table: source-table-name # Clone data from table
          recreate: true # default false
          config: # empty by default, for more options see https://github.com/enGMzizo/copy-dynamodb-table#aws-config-for-each-table--cross-region--
            accessKeyId: AKID
            secretAccessKey: SECRET
            region: eu-west-1
        data:
          - id: 'abc1'
            name: 'myRecordName1'
          - id: 'abc2'
            name: 'myRecordName2'
```

### Cognito

- [x] immutable attributes are set only first time, otherwise update of these attributes is skipped
- [x] `custom:` prefix for custom attributes is required
- [x] every created user has confirmed account status and no confirmation e-mail is sent
- [x] only attributes and password is updated if user exists

```yml
custom:
  seed:
    cognito:
      TodosUserPool:
        emptyOnly: true # default false - seed only if target is empty
        data:
          - username: abc1
            password: passw1
            attributes:
              - Name: custom:mutableClientData
                Value: mutableClientData_val
              - Name: custom:immutableClientData
                Value: immutableClientData_val
          - username: abc2
            password: passw2
            attributes: []
```

### S3

Do not forget to clear all objects from bucket, before `serverless remove` command called or use [our plugin](https://github.com/purple-technology/serverless-s3-remover)

- [x] all nested dirs and files will be uploaded
- [x] existing files will be overwritten

```yml
custom:
  seed:
    s3:
      TodosBucket:
        emptyOnly: true # default false - seed only if target is empty
        data:
          - ./somedir/
```

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