ECS autoscaling with an ASG capacity provider

0

We have configured an ECS cluster with an ASG capacity provider and CPU auto-scaling. Auto-scaling is trying to deploy more containers, but to do that it needs to start a new instance in the ASG

service X was unable to place a task because no container instance met all of its requirements. 
The closest matching container-instance X has insufficient CPU units available. For more information, see the Troubleshooting section of the Amazon ECS Developer Guide

Is this expected behavior? I was expected ECS autoscaling to try and launch instances in the cluster on its own

Thanks, Fouad

Fouad
已提問 5 個月前檢視次數 500 次
1 個回答
1

Yes, this is expected behavior when using an auto scaling group (ASG) with an ECS cluster.

The ECS auto scaling is responsible for scaling the tasks/containers based on metrics like CPU and memory utilization. However, it does not automatically launch new EC2 instances in the ASG.

The ASG is responsible for launching and terminating EC2 instances to maintain the desired capacity. But it does not know about ECS task placement requirements.

So when ECS wants to place more tasks, it first needs the ASG to launch new instances to add capacity to the cluster. The ASG won't do this on its own until its own scaling metrics (CPU, network etc.) trigger.

To solve this:

  • Configure ASG scale-out policies based on ECS metrics like pending tasks. This will trigger instance launches when ECS needs more capacity.

  • Use EC2 autoscaling directly instead of an ASG. ECS can then launch instances on its own when it needs more capacity.

  • Pre-warm your ASG to have spare capacity for ECS to scale out without waiting for new instances.

So in summary, the current behavior is expected due to the separation between ECS (scales tasks) and ASG (scales instances). You need to align their scaling metrics for a smoother experience.

AWS
Saad
已回答 5 個月前

您尚未登入。 登入 去張貼答案。

一個好的回答可以清楚地回答問題並提供建設性的意見回饋,同時有助於提問者的專業成長。

回答問題指南