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

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달 전

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인

관련 콘텐츠