A plugin to buld Dynamo DB with data for Serverless Framework.
- Populate Data into Dynamo during deployment through serverless. Can prevent additonal usage of lambdas for populating data into Dynamo DB,once the serverless deploy is completed
Run npm install
in your Serverless project.
$ npm install --save serverless-dynamo-build
Add the plugin to your serverless.yml file
plugins:
- serverless-dynamo-build
custom:
dynamoBuild:
# noOperation will determine if the below operations will be executed or not ( noOperation=true will ignore the below statements)
noOperation: false
# Multiple operations for multiple tables can be provided here
config:
- table: event
operation: UPDATE
# params contain multiple record details that needs to be inserted in the table
params:
- hashKey: eventPath
hashValue: name/{id}
rangeKey: eventData
rangeValue: eventValue
# updateKeys holds the set of fields that needs to be inserted
updateKeys:
- scope
- scope1
# updateValues holds the set of values that needs to be inserted for the above fields
updateValues:
- - scope/1
- scope/2
- - scope1/1
- scope1/2
- hashKey: eventPath
hashValue: description/{desc}
updateKeys:
- scope
updateValues:
- - scope/SCOPE3
- scope/SCOPE4
- table: event
operation: DELETE
params:
- hashKey: eventPath
hashValue: address/{id}
## Usage
Run `sls deploy`, Dynamo DB table will populated with data.
Run 'sls deploy --noDynamoBuild` if dynamo db population is not required
Run `sls dynamo build` to build up the dynamo db with values