简体   繁体   中英

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. 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

在此处输入图像描述

But when I search the public ip of ec2 it doesnot show anything. 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. 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

If the application is accessible on localhost then possible reasons are

  • Instance security group does not allow 5000 Port, so check the security group and allow HTTP traffic on port 5000 .

  • An instance might be in a private subnet, but how you do ssh from bastion or directly? if directly then the issue should be resolved by following step 1.

Use the public IP that you used for ssh and it should work

http://ec2Public_Ip:5000

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM