Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ECS service keeps deregistering Target Group and start/stop tasks

I have an ECS service that is repeatedly starting and stopping a task running on a EC2 (m5.large) launch type container. The Events tab says these messages in a loop -

service test-service deregistered 1 targets in target-group localhost-localhost-default

service test-service has begun draining connections on 1 tasks.

service test-service deregistered 1 targets in target-group localhost-localhost-default

service test-service has started 2 tasks: task 4e1569b3-a15c-4bac-85f7-396b530113a5 task d5651035-8e3d-48df-b457-d05e5b7be8db.

There is nothing more there to help understand what might be going on. When I checked the Target group itself, the instances are not registered anymore to it. I have allocated memory: 1024 and cpu: 512 for the task which should be enough.

Is there anything I can do to understand what the problem here is ?

like image 802
gamer Avatar asked Jan 11 '20 22:01

gamer


People also ask

What is responsible for starting and stopping tasks on an ECS container instance?

Q: What is responsible for starting and stopping tasks on an ECS Container instance. E: The ECS Agent is responsible for starting/stopping tasks. It also monitors tasks and resource utilization.

How do you stop an AWS ECS task after it has completed its task?

In order for a task to stop, container needs to exit, and for that the program/command that runs in the container just needs to exist with a status code 0.

What is deregister in ECS?

Deregistering a container instance removes the instance from a cluster, but it does not terminate the Amazon EC2 instance. If you are finished using the instance, be sure to terminate it to stop billing. For more information, see Terminate your instance in the Amazon EC2 User Guide for Linux Instances.

How can start stop task in ECS?

Open the Amazon ECS console at https://console.aws.amazon.com/ecs/ . On the Clusters page, select the cluster where your stopped task resides. On the Cluster : clustername page, choose Tasks. In the Desired task status table header, choose Stopped, and then select the stopped task to inspect.


Video Answer


1 Answers

On this line,

service test-service has started 2 tasks: task 4e1569b3-a15c-4bac-85f7-396b530113a5 task d5651035-8e3d-48df-b457-d05e5b7be8db.

Task ID is a hyperlink, when you click that it will take you the page where you can find all the details about that particular task.

Here there is a entry "stopped reason" which will show why was the task stopped.

If it stopped because of health check failures, it will show in events page itself.

like image 116
karthikeayan Avatar answered Oct 23 '22 19:10

karthikeayan