You can set the following two parameters to control container stop and start timeout at the container instance level:
1. In /etc/ecs/ecs.config, set the value of the ECS_CONTAINER_STOP_TIMEOUT parameter to the amount of time that you want to pass before your containers are forcibly killed if they don't exit normally on their own.
Note: The default value for Linux and Windows is 30s.
2. In /etc/ecs/ecs.config, set the value of the ECS_CONTAINER_START_TIMEOUT parameter to the amount of time that you want to pass before the ECS container agent stops trying to start the container.
Note: The default value is 3m for Linux and 8m for Windows.
Check this out for more info:
https://aws.amazon.com/premiumsupport/knowledge-center/ecs-tasks-stuck-pending-state/