ECS: Understanding of CapacityProviderReservation

1

Hello,

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 :)

Valentin

asked 2 years ago5922 views
2 Answers
1

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."

AWS
EXPERT
answered 2 years ago
0

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

answered 2 years ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions