Akshay Singh Kanawat
Akshay Singh Kanawat

Reputation: 31

AWS ECS Capacity providers

I created a capacity provider for a particular ecs cluster(t2.small) and it got attached to auto-scaling-group also. Now I am running 2 tasks with similar resource which utilizes t2.small completely. This is a batch job which runs for max 5 seconds. Now when I set desired count of tasks in service to 4 or 6 my cluster never scales out. According to https://aws.amazon.com/blogs/containers/deep-dive-on-amazon-ecs-cluster-auto-scaling/ , my CapacityProviderReservation should go 200% when desired count increases to 4. But average and maximum CapacityProviderReservation is not going beyond 100%.

I have already set autoscaling policy for service, but still I am not able to scale instances using capacity providers. Can anyone explain me how to implement it

Upvotes: 2

Views: 3234

Answers (1)

Ajay
Ajay

Reputation: 11

In that deep dive article, it explains:

CapacityProviderReservation = M / N * 100

Where:

  • M = the number of instances the cluster should have
  • N = the number of instances currently in the cluster

one of the factors to calculate "M", is the current number of tasks plus the tasks in the "PROVISIONING" state.

In order for a service to go into the "PROVISIONING" state, the service has to also be configured to use a capacity provider.

Once I converted a bunch of services over and scaled them up, there was no capacity for them and instead of failing instantly, they went into the "PROVISIONING" state.

At this point, CapacityProviderReservation went above 100% and the cluster scaled to meet the needs.

Upvotes: 1

Related Questions