How do I resolve "the closest matching container-instance container-instance-id encountered error 'AGENT'" error for my service in Amazon ECS?
"When I try to place a task in Amazon Elastic Container Service (Amazon ECS), I receive the following error: "[AWS service] was unable to place a task because no container instance met all of its requirements. The closest matching container-instance container-instance-id encountered error 'AGENT'.""
"When I try to place a task in Amazon Elastic Container Service (Amazon ECS), I receive the following error: "[AWS service] was unable to place a task because no container instance met all of its requirements. The closest matching container-instance container-instance-id encountered error 'AGENT'."Short DescriptionYou can receive this error when the Amazon ECS container agent running on the container instance designated for task placement is disconnected.Note: If you didn't receive the preceding error message, choose an article based on one of the following error messages that you received:[AWS service] was unable to place a task because no container instance met all of its requirements.[AWS service] was unable to place a task because no container instance met all of its requirements. The closest matching container-instance container-instance-id has insufficient CPU units available.ResolutionTo resolve this error, try the following troubleshooting steps:Check your agent logs1.    Connect to the container instance using SSH.2.    Check your agent logs at /var/log/ecs/ecs-agent.log.YYYY-MM-DD-HH.Note: Replace the timestamp with one that's appropriate for your logs.Verify that the agent is running on the instance1.    Connect to your EC2 instance using SSH.2.    To return a list of your containers, run the following command:docker psLook for a container running with the name ecs-agent. For more information, see Why is my Amazon ECS agent listed as disconnected?Restart the agentIf you're using the Amazon ECS-optimized AMI, stop and restart the agent with the appropriate command.For Amazon ECS-optimized Amazon Linux 2 AMIs, run the following command:sudo systemctl restart ecsFor Amazon ECS-optimized Amazon Linux AMIs, run the following command:sudo stop ecs && sudo start ecsRelated InformationHTTP Proxy ConfigurationUpdating the Amazon ECS Container Agent on an Amazon ECS-optimized AMIManually Updating the Amazon ECS Container Agent (for Non-Amazon ECS-Optimized AMIs)Follow"