- Newest
- Most votes
- Most comments
Hi Tom,
The ASG doesn't know about the ECS service and won't scale by itself. There are two common ways to setup scaling on it to make sure there are instances added to the cluster when needed
- Use the same metric for both the ASG and service so that they both get alarms triggered at the same time. This could potentially be subject to a race condition where the queue length metric triggers an alarm for the ASG or service, and the alarm ends up moving back to OK before the other one scales
- Use CAS (Cluster AutoScaling) to trigger the ASG based off the tasks running/pending in the cluster
Hi Shahad,
Thanks for the response. I'm fairly certain that I'm currently using CAS. In the CDK I attached the auto scaling group to the ECS Cluster as a capacity provider which based of the link you provided and elsewhere should cause ECS to manage the EC2 scaling.
Interestingly I manually increased the desired capacity of the ASG to 2 and once my cluster scaled down to a single task the ASG scaled in the extra EC2 instance that was running so the scaling in seems to be working correctly but the scaling out isn't.
It is like it's not detecting tasks until they are at least pending which obviously it can't get to unless there is capacity available
Relevant content
- asked 7 months ago
- AWS OFFICIALUpdated 9 months ago
- AWS OFFICIALUpdated a year ago
- AWS OFFICIALUpdated 4 months ago
Hello,
have you been able to solve this problem? I am facing it as well.
I have AutoScalingGroup(min size 0, max size 5) and ECSCapacityProvider referencing this group uses Managed Scaling.
When I create ECS Service in the cluster it tries to place task on the cluster, but fails with error:
I would expect ECS would spawn new instance and add it to the ASG and the cluster.
Btw I am using Cloudformation, should not really matter though.