我如何在Node中使用亚马逊的Dynamodb Local?
亚马逊提供local simulator for their Dynamodb product但examples are only in 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中工作?
回答如下:你应该按照这个blog post设置你的DynamoDB Local,然后你可以简单地使用这个代码:
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);
});