我正在尝试从节点调用lambda函数。
var aws = require('aws-sdk');
var lambda = new aws.Lambda({
accessKeyId: 'id',
secretAccessKey: 'key',
region: 'us-west-2'
});
lambda.invoke({
FunctionName: 'test1',
Payload: JSON.stringify({
key1: 'Arjun',
key2: 'kom',
key3: 'ath'
})
}, function(err, data) {
if (err) console.log(err, err.stack);
else console.log(data);
});
密钥适用于IAM用户。用户必须AWSLambdaExecute
和AWSLambdaBasicExecutionRole
附加政策。
我收到权限错误:
AccessDeniedException: User: arn:aws:iam::1221321312:user/cli is not authorized to perform: lambda:InvokeFunction on resource: arn:aws:lambda:us-west-2:1221321312:function:test1
我阅读了文档和几个博客,但无法授权该用户调用lambda函数。如何让该用户调用lambda?
谢谢。