dynamodbexport
Command-line utility to export a DynamoDB database to a list of JSON documents.
Installation
The dynamodbexport package is installed via npm:
npm install -g dynamodbexport
You may need to precede the above command with sudo
, depending on your Node.js installation.
Configuration
The dynamodbexport command-line tool assumes a locally installed copy of DynamoDB by default. If you want to use hosted DynamoDB, then supply your AWS key and secret key as environment variables:
export AWS_ACCESS_KEY_ID="OGIIWJGNWNIITJHWTHSO"export AWS_SECRET_ACCESS_KEY="YRPHIIIWJJJYwKLGV28JJuiuwnjiiqq06ASn"
The AWS Region must also be set with the -r
or --region
command-line parameter.
Command-line Usage
Use the dynamodbexport tool to export an entire DynamoDB table. The table is specified with the -t
or --table
command-line parameter:
$ dynamodbexport -t mytable -r us-east-1{"temperature":8391,"time":"2017-03-09T01:38:11+0000","id":"1489023491"}{"temperature":29130,"time":"2017-03-09T02:35:37+0000","id":"1489026937"}{"temperature":27650,"time":"2017-03-08T18:35:58+0000","id":"1488998158"}Export complete
The data can be directed to a text file:
$ dynamodbexport -t mytable > mydata.txtExport complete
or piped elsewhere e.g. to couchimport to import the data into Apache CouchDB:
$ dynamodbexport --table mytable | couchimport --db mycouchtable --type jsonlExport complete
Programmatic Usage
You can also use the library within your own code:
var dynamodbexport = ;var region = 'us-east-1';var table = 'mytable';dynamodbexport;
Options Reference
Command-line parameters
- -t or --table - the table to export (required)
- -r or --region - the AWS region to communicate with (for remote DynamoDB exports only)
Environment variables
- AWS_ACCESS_KEY_ID - the AWS key
- AWS_SECRET_ACCESS_KEY - the AWS secret
N.B The role attached to the credentials you supply must have DynamoDB.Scan
privileges.