我如何在节点中使用Amazon的Dynamodb Local?
Amazon 为他们的Dynamodb产品提供了一个本地模拟器,但这些例子只在PHP中 。
这些示例提到传递参数“base_url”来指定您正在使用本地Dynamodb,但在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 }
Dynamodb_local如何在Node中工作?
您应该按照此博客文章设置您的DynamoDB本地,然后您可以简单地使用此代码:
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); });