serverless-dynamodb-local
serverless-dynamodb-local copied to clipboard
Every time I restart dynamodb local and run "sls dynamodb start" the content of the DB is wiped
Actual Behaviour
i run sls dynamodb start - I populate the database, I stop dynamodb local and run it again, and table is recreated and content wiped.
This is my .yml configuration
dynamodb:
start:
migrate: true
inMemory: false
stages:
- ${self:provider.stage}
Expected Behaviour
Given that inMemory: is set to false I would expect the data to be written to disk and next time I restart the server the data should be there.
Steps to reproduce it
Just start server with sls dynamodb start - populate some data, and restart the server and data will be gone.
Using migrate: true means recreating tables on start. If you drop that your data should persist, but you will need to manually migrate if you make changes.
what are the steps to persist the data between restarts?
EDIT: If you want your tables to start with dummy data instead of empty, follow the next steps:
- use seed: true next to inMemory: true inside dynamodb section in serverless.yml
- In serverless.yml create a new section inside custom > dynamodb > seed like this
- You need a json file with dummy data to fill your table with the properties matching the same data type defined for your table
That's it, the next time you run sls offline start your tables will automatically be filled with the dummy data from your json files