serverless-seed-plugin
This plugin is still in WIP and non-stable.
This plugin seeds the data for AWS resources.
Supported resources
AWS::DynamoDB::Table
AWS::Cognito::UserPool
AWS::S3::Bucket
Install
$ npm install --save-dev serverless-seed-plugin
Add the plugin to your serverless.yml
file.
plugins:
- serverless-seed-plugin
Usage
Set up custom.seed.<resource>.<options>
in your serverless.yml
file. You can also follow the code in ./example/ dir.
Then run serverless seed
.
DynamoDB
custom:
seed:
dynamodb:
TableId:
truncate: true
clone:
table: source-table-name
recreate: true
config:
accessKeyId: AKID
secretAccessKey: SECRET
region: eu-west-1
data:
- id: 'abc1'
name: 'myRecordName1'
- id: 'abc2'
name: 'myRecordName2'
Cognito
custom:
seed:
cognito:
TodosUserPool:
- 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
custom:
seed:
s3:
TodosBucket:
- ./somedir/