AWS ECS tasks stuck in pending state
This happens when the ECS agent become not reponsing or lost connection. ECS agent in the corresponding EC2 instance need to be restarted inorder to resolve this problem.
On Amazon Linux 1 instances,
#sudo stop ecs
#sudo start ecs
On Amazon Linux 2 instances,
#sudo systemctl stop ecs
#sudo systemctl start ecs
That's all…