https://github.com/purple-technology/serverless-seed-plugin
This plugin seeds the data for AWS resources.
https://github.com/purple-technology/serverless-seed-plugin
aws cognito dynamodb plugin plugin-seeds s3 seed serverless
Last synced: 6 months ago
JSON representation
This plugin seeds the data for AWS resources.
- Host: GitHub
- URL: https://github.com/purple-technology/serverless-seed-plugin
- Owner: purple-technology
- License: mit
- Created: 2021-05-31T07:29:43.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2023-12-15T02:20:19.000Z (over 2 years ago)
- Last Synced: 2025-09-20T05:27:15.764Z (7 months ago)
- Topics: aws, cognito, dynamodb, plugin, plugin-seeds, s3, seed, serverless
- Language: JavaScript
- Homepage:
- Size: 425 KB
- Stars: 2
- Watchers: 10
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# serverless-seed-plugin
This plugin is still in WIP and non-stable.
[](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..` 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/
```