ECS: Understanding of CapacityProviderReservation
I'm trying to understand why an ECS cluster configured with a capacity provider for EC2 with no defined service or running tasks, an empty cluster then, has a CapacityProviderReservation at 100 at all times.
Following the explanation of https://aws.amazon.com/fr/blogs/containers/deep-dive-on-amazon-ecs-cluster-auto-scaling/ CapacityProviderReservation = M / N x 100 where N = Already running instances and M = Needed instances In my case, there is no needed nor running instances because there is nothing to run so N and M are equal 0, so why is CapacityProviderReservation always at 100 ? When there is only one server in the autoscaling group there is no issue, but if the max capacity is > 1 then when I start a task CapacityProviderReservation = 200 so 2 instances are started when only is needed.
If anyone can enlighten me I would be very grateful :)
When you set an EC2 Capacity Provider reservation target to 100% (which is the value I generally recommend to customers), you're telling ECS to provision only the amount of compute needed to satisfy the current number of running tasks: no more, no less.
The CloudWatch metric CapacityProviderReservation reflects the current ratio of resource demand (i.e., your tasks) to resource supply (i.e., the EC2 instances on hand). When the current value is 100, it means everything is in equilibrium: supply is sufficient to meet demand. If the value goes over 100, it means the Auto Scaler needs to provision more instances, and when the value falls below 100, it means the Auto Scaler can terminate some instances.
So, in a steady state -- even when the number of ECS tasks and EC2 instances is 0 -- the value can be equal to 100. It's perfectly normal and it means "don't change anything."
Thank you for the clarification, so there is no problem with my config, and it is normal that when I start a task the CapacityProviderReservation is set to 200 and then 2 instances are started, then after a couple of minutes CapacityProviderReservation goes back to 100 and only the needed instance is kept. It is a pity that we have to pay 15 minutes of usage for an instance which is not needed each time we run a task
ECS Capacity providers best practicesAccepted Answerasked a month ago
Why do deployments with CodeDeploy to ECS (fargate) without tasks succeed?asked 8 days ago
Should ECS/EC2 ASGProvider Capacity Provider be able to scale-up from zero, 0->1Accepted Answer
How many Load Balancers of what schemes are actually required while creating an ECS cluster with AutoScaling Via Capacity Provider?asked 3 months ago
ECS: Understanding of CapacityProviderReservationasked a month ago
Should ECS Service Task start be triggered by ASG capacity 0->1?Accepted Answer
ECS: Capacity Provider vs Autoscaling Groupasked 5 months ago
ECS: Random container failed to start - no logasked 7 days ago
Use AWS FARGATE_SPOT as fallbackAccepted Answerasked 2 years ago
How to I troubleshoot a deploy that is forever in "IN_PROGRESS"?asked 6 months ago