[英]Cannot access ecs ec2 instance public ip
I am connecting 2 docker container one python app container and redis container with each other using ECS.我正在使用 ECS 将 2 个 docker 容器、一个 python 应用程序容器和 redis 容器相互连接。 When I ssh into ec2 instance and curl localhost:5000 it gives the output which means the container are running and python is connected with redis.
When I ssh into ec2 instance and curl localhost:5000 it gives the output which means the container are running and python is connected with redis. I am trying to achieve the result with ECS Ec2
我正在尝试使用 ECS Ec2 实现结果
But when I search the public ip of ec2 it doesnot show anything.但是当我搜索 ec2 的公共 ip 时,它没有显示任何内容。 My task configuration setting:
我的任务配置设置:
and in python container I am having this setting, pulling the image from ecr and giving the port 5000:5000 and in link giving the name of redis so the it can connect to redis container.在 python 容器中,我有此设置,从 ecr 中提取图像并提供端口 5000:5000 并在链接中给出 redis 的名称,以便它可以连接到 Z86A1B907D54BF7010394BFFE366 容器。 What setting Am I missing so that I can hit the python app container without doing ssh to the ec2-instance and doing curl localhost:5000
我缺少什么设置,以便我可以点击 python 应用程序容器,而无需对 ec2 实例执行 ssh 并执行 curl localhost:5000
If the application is accessible on localhost then possible reasons are如果应用程序可以在 localhost 上访问,那么可能的原因是
Instance security group does not allow 5000
Port, so check the security group and allow HTTP traffic on port 5000
.实例安全组不允许
5000
端口,因此检查安全组并允许端口5000
上的 HTTP 流量。
An instance might be in a private subnet, but how you do ssh from bastion or directly?一个实例可能位于私有子网中,但是您如何从堡垒或直接执行 ssh 呢? if directly then the issue should be resolved by following step 1.
如果直接,则应按照步骤 1 解决该问题。
Use the public IP that you used for ssh and it should work使用您用于 ssh 的公共 IP,它应该可以工作
http://ec2Public_Ip:5000 http://ec2Public_Ip:5000
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.