ECS EC2 launch type and event was unable to place a task because no container instance met all of its requirements

0

I'm trying to learn more about ECS with EC2 launch type.

Sometimes, when updating the Task Definition or Service I see the following error in the Service events

service ecs-service was unable to place a task because no container instance met all of its requirements. The closest matching container-instance XXX has insufficient CPU units available. For more information, see the Troubleshooting section.

I checked the suggested docs: https://docs.aws.amazon.com/AmazonECS/latest/developerguide/troubleshooting.html

I also checked: https://docs.aws.amazon.com/AmazonECS/latest/developerguide/service-event-messages.html

In my Task Definition I have:

  • For the Task Definition CPU 2048 and Memory 1024
  • For the container CPU 1024 and Memory 1024 (I tried also setting the CPU value to 2048).

Why this happens randomly? What can I do to fix it? When this happens the service seems to get stuck and even after long waits, nothing happens.

asked 2 years ago290 views
1 Answer
0

Hi, here there is a nice summary of all the reason behind the issue that you are facing https://repost.aws/knowledge-center/ecs-container-instance-requirement-error

  • Not enough memory for your tasks
  • Not enough CPU units for your container instance
  • No container instances were found in your cluster
  • The port needed by the task is already in use
  • Not enough available elastic network interface attachment points
  • A required attribute is missing for your container instance

The first 2 of the list are the one that most likely happening if you select a small EC2 instance to perform your tests

AWS
answered 10 months ago

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