AWS ECS tasks being stopped and restarted. CURL no reply from server

Jason Linthwaite
Jason Linthwaite used Ask the Experts™

I have a task in AWS that is started by ECS. I have developed a Cloudformation script that creates the ECS cluster, service, task definitions and containers.

The EC2 instances (2 to begin with) are initiated and are healthy. ECS then creates the tasks on each EC2 instance. However, have 1 minute, the tasks are stopped by ECS and it tries to recreate it. I presume this is something to do with the scheduler on AWS and not getting a healthy check back.

It is a node app running on port 300 which is mapped to the container. If I login to the EC2 instance and do a simple curl (host port) then I get "no reply from server". Ok so it is something wrong with the image or container.

However, if I launch my own container of the same image publishing the ports ("docker run -d -p 32810:3000 <image> yarn start") and then do curl then I get a response from the server.

I cannot figure out how to debug this as there are no logs with any errors. Anyway..(I created the one on port 32810) the image is the same in both. I can only figure it is something to do with what the ECS agent does when it boots a task.

48ccad832ad2        <image>   "yarn start"        9 seconds ago       Up 8 seconds>3000/tcp   ecs-test-InterfaceCogTaskDefinition-1UE2FONT2RQU3-1-InterfaceCog-f092fec2d9d1e8a90300
36016de55b81        <image>   "yarn start"        23 minutes ago      Up 23 minutes>3000/tcp   practical_banach

Anyone have experience and might think how to debug this?

Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Kyle SantosSoftware Test Analyst I at Dassault Systemes


I am here to help you with your open question.  Do you still need help?  I have the ability to alert more experts if you still need help.

If you solved the problem on your own, would you please post the solution here in case others have the same problem?

If you need me to delete this question just say "Delete."

Thank you for using Experts Exchange.


Kyle Santos
Customer Relations

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial