dynamo-localdb
Simple node module that is used to launch and setup local running DynanoDB in a development environment. Unlike other NPM dynamodb modules, this project is more a developer's tool than a simple DynamoDB launcher as it provides a client too. The purpose is to allow developers working DynamoDB projects to quickly setup and reset the database to a given configration (data and schemas alike).
Instructions
Commands
let config = /* ... */ let LocalDB = ;let db = config;
db.start()
: Starts the local DynamoDB server.db.kill()
: Kills the local running DynamoDB server.db.load()
: Configures DynamoDB with the given configuration.db.reload()
: Drops all tables, then callsdb.load()
.db.test()
: Tests where the module's client can interact with the server.
Installation
npm install dynamo-localdb --save
Requirements
- Java is required for DynamoDB server.
- Has only been tested NodeJS v6.9.2.
Examples
Starting up the local DynamoDB server.
let LocalDB = ;let db = ;dbstart;
Quick test of the server and client.
let LocalDB = ;let db = ;dbstart;
Starting up the local DynamoDB with configuration data for the server.
let LocalDB = ;let config = server: port: 3000 client: region: "us-east-1" endpoint: "http://localhost:3000" let db = ;dbstart;
Starting up the local DynamoDB with configuration for the schemas, and data.
let LocalDB = ;let config = schemas: /* scheme data as defined by AWS.DynamoDB.createTable() documentation... */ /* http://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/DynamoDB.html#createTable-property */ data: "name-of-table": /* json representation of data for the given table... */ let db = ;dbstart;
Configuration
let config = server: port: 8000 /* see full list of available options defined at... */ /* https://github.com/Medium/local-dynamo */ client: region: "us-east-1" endpoint: "http://localhost:8000" accessKeyId: "AKID" serectAccessKey: "SECRET" /* see full list available options defined at... */ /* http://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/Config.html#constructor-property */ schema: /* array of schemas */ /* see AWS.DynamoDB.createTable() documentation */ /* http://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/DynamoDB.html#createTable-property */ data: "TABLE-NAME-HERE" : /* array of documents for given table */ /* json representation a documnent's data for the given table... */
Note
- If
server.port
is changed, the port value must match atclient.endpoint
.
Troubleshooting
- Change server process
stdio
setting toinherit
so that stderr pipes to the console.- By default server process
stdio
, is set toignore
.
- By default server process
- Error: `missing 'server' JVM...' error
- Follow these steps to resolve.