[AWS fargate tutorial] cannot access webpage hosted in a container on ECS

0

I am doing this ECS fargate tutorial. I followed prerequisites and each step but cannot access a webpage in step 4. The chrome browser error msg is like

This site can't be reached
container.public.ip.address took too long to respond.
     :
ERR_CONNECTION_TIMED_OUT

I am not sure where I went wrong but it seems web server does not respond properly. What I did so far is

  • Increased resource(both cpu and memory)
  • checked security group settings
  • checked the service is supported in my region
  • changed browser to access the webpage
  • did a little search here and on the internet

but nothing works out.

Additional info: my region is ap-northeast-1.

Cound you give me some tips?

Thanks in advance,

asked a year ago422 views
1 Answer
0

Hi,

Some things you can check are:

  1. Check that the pod is in RUNNING state and not PENDING
  2. Verify that the Allowed subnets configured for the ECS service is not a private subnet. Even with Public IP enabled you cannot access pod in private subnet.

--Syd

profile picture
Syd
answered a year ago
  • Thanks for your comment. About no.1, since I am new to ECS so I am not really sure what is ECS counterpart of k8s pod but ECS service, task and container seems running properly. About no.2, I just checked all subnets used for ECS are default subnets which are public subnet. I also ensured public ip is enabled. I still cannot get it working.

  • Sorry for the terminology exchange. You can equate ECS task to the pod :) You stated that tasks are running, it's in public subnets. I cannot think of any other reason that should cause the issue you mentioned about. I was able to follow the documentation and have it running in ap-northeast-1. By any chance do you have a firewall that might block outbound traffic from your side? You can check with ping, traceroute etc by adding the equivalent rule in security groups or allowing all traffic (for testing) I assume you would have tried to delete and started all over again also to rule out if you missed anything

  • I finally figured out the culprit was sg. I misunderstood the inbound rule setting of a default sg. This doc (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/default-custom-security-groups.html) says default sg inbound rule allows access from network interface and ec2 which are associated with the default sg so access from outside vpc is not allowed. Thanks for your help, Syd!

    You can equate ECS task to the pod :)

    Thanks for the info!

    I was able to follow the documentation and have it running in ap-northeast-1.

    Thanks for confirming this tutorial is working. It was my mistake.

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions