1
votes

I have ECS cluster and have one task per one EC2 instance + ALB .

As understood from AWS workshop https://ecsworkshop.com/capacity_providers/ec2/ capacity provider helps place tasks to ec2 instances when cluster scaling. For example 8 tasks and 4 ( t2.small ) instances by 2 tasks per instance

But in my case ( one task per one EC2 instance ) should i need configure capacity provider for my cluster? Maybe capacity provider solve additional problems? ( scaling out / in ) for example

When capacity provider is really needed. Should i configure for one capacity provider in cluster, default capacity provider strategy in my ecs service?

1
Are you saying you have a static amount of ECS tasks on the same static amount of EC2 instances? In that case then you don't need the managed scaling part of capacity providers.ydaetskcoR
The capacity provider should handle that fine and automatically scale out the instances if it needs to scale out the tasks. It works a little like the cluster autoscaler in Kubernetes in that it looks at the required resources that are being asked for and scales to match that. Previously you would scale based on resource utilisation of the existing instances.ydaetskcoR
How do you intend to scale out both the task and the underlying instance when CPU utilisation is high as you mentioned above? The normal approach here is to have an ECS service autoscaling policy track the CPU utilisation and then have the capacity provider make sure to expand the EC2 instances to support the required number of ECS tasks.ydaetskcoR
Are you setting the alarm for both the ECS service and the ASG average CPU utilisation? This is hard to answer adequately without you expanding your question showing what you've tried so far and then focusing your question on exactly what you want to know.ydaetskcoR
As I said above, capacity providers simplify the scaling policy in that you look at the resources required for any running and pending tasks. Using non capacity provider scaling means you are looking purely at existing utilisation. If your ECS and ASG scaling is completely coupled then it might do nothing for you. If you decide to add another ECS service that wants to run on the same cluster than the capacity provider becomes much more useful.ydaetskcoR

1 Answers

2
votes

The way I'm reading your scenario, it sounds like you're using a placement constraint of "distinctInstance" -- in this case, if you use a capacity provider, it should handle the scaling out and in of your EC2 instances as your task count grows and shrinks. Please let me know if I'm misunderstanding, though!