I’m trying to run an ECS task in AWS using the EC2 launch type. This task has been running for almost a year without problems, but a few weeks ago it stopped working.
When I create a new task, it remains in "provisioning" until it fails. The error I’m getting is "TaskFailedToStart: EMPTY CAPACITY PROVIDER". I have been looking for answers but so far I have found nothing useful. Can anyone help with some ideas of what may be happening?
This is the autoscalling group configuration:
autoscalling config
2
Answers
I faced the same issue. In my case the ACL rules attached to the related subnets were too restrictive and somehow EC2, ASG and ECS could not communicated with each other.
Please try – just for debugging – to open the inbound & outbound rules for all. See https://docs.aws.amazon.com/vpc/latest/userguide/vpc-network-acls.html#default-network-acl
If it works with wide open ACL rules, then you know the root cause and can work on this issue.
When you create ECS cluster, AWS creates a Cloudformation stack with a lot of resources:
and so on… then when you delete/recreate something it stops working (or you’ll find that when you create a new capacity provider inside cluster, it is created (visible thru AWS CLI), but does not appear in the list. And then you cannot create a new capacity provider because the name is already taken. And you cannot find it anywhere in AWS Console as there is no view to list capacity providers (looks like they are shown inside cluster only). BUGGY BUGGY architecture.
Ideally delete the cloudformation stack & create everth yourself:
you would be able to switch ASGs and launch templates inside ASG without much hassle. do not know why AWS in some cases uses Cloudformation stacks and in some does not, and does not inform user about it. Then after some time you discover all those abandoned stacks and have no clue why they were created.