Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I export data (tables and data) from AWS DynamoDB and import into a local DynamoDB?

I would like to create an isolated local environment (running on linux) for development and testing.

How can I export data (~10 tables and ~few hundred items of data) from AWS DynamoDB ind import into a local DynamoDB instance?

like image 522
Vihung Avatar asked Apr 07 '19 09:04

Vihung


1 Answers

I've not tried this, but you should be able to use the CLI.

First extract the data into local JSON files

aws dynamodb scan --table-name MYLIVETABLE --output json > pathtofile/MYLIVETABLE.json

And then load that data into your local DynamoDB instance

aws dynamodb batch-write-item --table-name MYLOCALTABLE --request-items file://pathtofile/MYLIVETABLE.json --endpoint-url http://localhost:8000
like image 173
F_SO_K Avatar answered Sep 19 '22 22:09

F_SO_K