我正在尝试通过使用节点js的lambda函数更改弹性搜索访问策略,当前访问策略看起来像波纹管
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Principal": {
"AWS": "*"
},
"Action": "es:*",
"Resource": "arn:aws:es:us-east-1:XXXX:domain/YYY/*"
}
]
}
我在lambda中尝试过的代码
var params = {
DomainName: 'YYYY'
};
const es = new AWS.ES();
es.upgradeElasticsearchDomain(params, function(err, data) {
if (err) console.log(err, err.stack); // an error occurred
else console.log(data); // successful response
});
这总是抛出错误
is not authorized to perform: es:UpdateElasticsearchDomainConfig on resource
,错误代码为"code": "AccessDeniedException",
在param
中,我将添加AccessPolicies
,这与我在问题中添加的策略相同,但Effect
将是Deny