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?
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.
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).
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.
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); });
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With