gpt4 book ai didi

node.js - 从Lambda函数访问AWS Elasticsearch

转载 作者:行者123 更新时间:2023-12-02 23:10:03 25 4
gpt4 key购买 nike

我正在尝试从Lambda函数访问我的AWS Elasticsearch。

使用无服务器框架和基于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"
}
}
}
]
}

最佳答案

您是否正在签署对ES实例的请求?根据https://docs.aws.amazon.com/elasticsearch-service/latest/developerguide/es-ac.html#es-managedomains-signing-service-requests

To make calls to the Elasticsearch APIs, you must sign your own requests.

关于node.js - 从Lambda函数访问AWS Elasticsearch,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61295471/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com