Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How I can work with Amazon's Dynamodb Local in Node?

Amazon offers a local simulator for their Dynamodb product but the examples are only in PHP.

These examples mention passing the parameter "base_url" to specify that you're using a local Dynamodb, but that returns this error in Node:

{ [UnrecognizedClientException: The security token included in the request is invalid.]   message: 'The security token included in the request is invalid.',   code: 'UnrecognizedClientException',   name: 'UnrecognizedClientException',   statusCode: 400,   retryable: false } 

How do I get Dynamodb_local working in Node?

like image 748
danmcc Avatar asked Nov 08 '13 21:11

danmcc


People also ask

How do I connect to AWS DynamoDB locally?

To access DynamoDB running locally, use the --endpoint-url parameter. The following is an example of using the AWS CLI to list the tables in DynamoDB on your computer. The AWS CLI can't use the downloadable version of DynamoDB as a default endpoint. Therefore, you must specify --endpoint-url with each AWS CLI command.

Can you use DynamoDB locally?

DynamoDB Local is available as a download (requires JRE), as an Apache Maven dependency, or as a Docker image. If you prefer to use the Amazon DynamoDB web service instead, see Setting up DynamoDB (web service).

How do I start DynamoDB locally?

The application doesn't run on earlier JRE versions. After you download the archive, extract the contents and copy the extracted directory to a location of your choice. To start DynamoDB on your computer, open a command prompt window, navigate to the directory where you extracted DynamoDBLocal.


1 Answers

You should follow this blog post to setup your DynamoDB Local, an then you can simply use this code:

var AWS= require('aws-sdk'), dyn= new AWS.DynamoDB({ endpoint: new AWS.Endpoint('http://localhost:8000') });  dyn.listTables(function (err, data) {    console.log('listTables',err,data); }); 
like image 157
aaaristo Avatar answered Oct 09 '22 19:10

aaaristo