TransWikia.com

AWS ECS: Unable to place task

Server Fault Asked by Jonathan Coustick on December 27, 2021

I am trying to set up an AWS service with autoscaling. I have created a cluster with an application loadbalancer and created a task using a docker image that should be open on port 8080 for use. I have created a service based on that task for which I have set minimum and desired number of instances to 1 and maximum to 10, and created rules for scaling up and down. However, no new instances are created and all I get in the list of events at regular intervals is:

service microrecieverservice was unable to place a task because no container instance met all of its requirements. The closest matching container-instance 97d97ce9-967d-49ad-83ad-f4f904aae1f6 is already using a port required by your task. For more information, see the Troubleshooting section.

I have not been able to find anything relevant in the troubleshooting section. I have been able to manually add another instance to the cluster, but with no change in the events given. I could ssh into this instance, and there were two docker images: one was amazon-ecs-agent:latest and the other was my task definition. At this point I tried sending a REST request to the server to see if it would go through but got Connection Refused. At about the same time, the docker image restarted.

The container is not running anything else that would use port 8080 and when I do netstat -lntp the process using port 8080 is that of the my docker image.

One Answer

Most likely, your task uses port 8080 as a static port.

Since you have only one instance in your cluster, you can not update your service while still adhering to your placement strategy, which most likely requires to start the new task first, wait for the health check to succeed, than to stop the old task.

With the only instance having a task running on port 8080, there is no instance available on which the task can be started.

Use ECS dynamic port mapping, or start more instances in your cluster.

Answered by M. Glatki on December 27, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP