Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Every time I restart dynamodb local and run "sls dynamodb start" the content of the DB is wiped #259

Open
nelsongallardo opened this issue Jan 3, 2021 · 2 comments

Comments

@nelsongallardo
Copy link

nelsongallardo commented Jan 3, 2021

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.

@jvarho
Copy link

jvarho commented Mar 22, 2021

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.

@marcodali
Copy link

marcodali commented Nov 11, 2022

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:

  1. use seed: true next to inMemory: true inside dynamodb section in serverless.yml
  2. In serverless.yml create a new section inside custom > dynamodb > seed like this
  3. 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

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants