我正在尝试从Lambda函数访问我的AWS Elasticsearch。
通过使用Serverless框架和基于IP的访问策略,我已经能够在本地实现这一点。
对于已部署的lambda函数,我尝试在我的访问策略中使用Lambda函数角色的ARN和Lambda函数的ARN (在控制台中查看该函数时位于右上)。
遗憾的是,我仍然遇到以下错误:User: anonymous is not authorized to perform: es:ESHttpPost
这是我的AWS访问策略:
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Principal": {
"AWS": "arn-of-lambda-function-role"
},
"Action": "es:*",
"Resource": "my-resource-arn"
},
{
"Effect": "Allow",
"Principal": {
"AWS": "*"
},
"Action": "es:*",
"Resource": "my-resource-arn",
"Condition": {
"IpAddress": {
"aws:SourceIp": "my-ip"
}
}
}
]
}
发布于 2020-04-18 12:20:21
您是否将请求签名到ES实例?根据https://docs.aws.amazon.com/elasticsearch-service/latest/developerguide/es-ac.html#es-managedomains-signing-service-requests
要调用Elasticsearch,必须对自己的请求进行签名.
https://stackoverflow.com/questions/61295471
复制