这是我的代码
var dynamodb = new AWS.DynamoDB();
dynamodb.batchGetItem(params, function(err, data) {
if (err) console.log(err, err.stack); // an error occurred
else console.log(data); // successful response
});
我收到了这个错误
{
message: 'Could not load credentials from any providers',
errno: 'ETIMEDOUT',
code: 'CredentialsError',
syscall: 'connect',
address: 'x.x.x.x',
port: 80,
time: 2019-03-13T07:59:34.279Z,
originalError: {
errno: 'ETIMEDOUT',
code: 'ETIMEDOUT',
syscall: 'connect',
address: 'x.x.x.x',
port: 80,
message: 'connect ETIMEDOUT x.x.x.x:80'
}
}
我是 AWS 新手。我认为使用 Lambda 调用 DynamoDB 不需要访问权限和 key 。那是对的吗? 我还授予完整的 DynamoDB 访问权限角色。是什么原因导致这个问题?
最佳答案
我在这里遇到了同样的问题。原因是您的 Lambda 函数似乎位于 VPC 内部,而 DynamoDB 则不然。尝试删除设置中网络部分的 VPC,应该可以解决。
关于amazon-web-services - 无法将 DynamoDB 与 Lambda 连接,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55137164/