从Fargate任务连接到Elasticsearch
我们的Fargate任务被允许连接到AWS ES / OpenSearch。它是通过此政策设置的:
{
Version = "2012-10-17",
Statement = [
{
Effect = "Allow",
Action = "es:ESHttp*",
Resource = "*"
}
]
}
从我们的Symfony(PHP)应用程序中,它可以完美地工作。但是,我想从运行任务中的命令行尝试一下。因此,我将“ Exec”进行到一个运行的容器中,并进行了卷曲请求。回应是:
{"Message":"User: anonymous is not authorized to perform: es:ESHttpGet"}
看来我不完全了解它的工作原理。我希望请求成功,因为我从任务发送了请求,该请求可以与ES交谈。我想念什么?
Our Fargate tasks are allowed to connect to AWS ES / OpenSearch. It's set up with this policy:
{
Version = "2012-10-17",
Statement = [
{
Effect = "Allow",
Action = "es:ESHttp*",
Resource = "*"
}
]
}
And from our Symfony (PHP) application it works flawlessly. However I wanted to try it from the command line inside a running task. So I did a "exec" into one running container and did a CURL request. The response is:
{"Message":"User: anonymous is not authorized to perform: es:ESHttpGet"}
It seems I don't fully understand how it works. I expected the request to be successful, because I sent the request from a task, which is allowed to talk to ES. What am I missing?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
从OpenSearch(ES)到ECS Fargate连接,
需要使用NAT网关创建私人子网才能创建ECS服务
BCOZ FARGATE一旦创建了私有子网,就没有任何IP在OpenSearch中提及连接
,请使用该私有子网创建ECS服务。
在ECS服务安全组中提及负载平衡器安全组。
在OpenSearch中提及Nat Gateway公共子网IP,
&
在ECS任务角色连接中附加以下策略
将顺利进行。
From Opensearch(ES) to ECS Fargate connection,
Need to create private subnets with NAT Gateway to create ECS Service
Bcoz fargate not having any ip to mention in opensearch for connection
Once Private subnet created , create ecs service with that private subnet.
Mention load balancer security group in ecs service security group.
Mention NAT gateway public subnet IP in opensearch,
&
attach the below policy in ECS task role
Connection will work smoothly.