2
votes

I have a Fargate service running using NetworkLoadBalancedFargateService from the CDK, and am currently trying to configure autoscaling for the service. When looking at my service through the ECS console, I see that the tasks running under it have "Fargate" as the launch type. Since it uses launch type, there's no way to specify a capacity provider strategy (from note in AWS docs. I've read a bit about capacity providers, and I'm not sure I actually need to worry about them. As far as I can tell, you can define a capacity provider strategy to specify a split between different capacity providers. For Fargate, the capacity provider choices are FARGATE and FARGATE_SPOT. For my service, I would want only FARGATE providers. Is there a difference between using the Fargate launch type and using a capacity provider strategy that's 100% FARGATE? Is there even a way to specify a capacity provider strategy for your tasks through the CDK?

3

3 Answers

1
votes

Is there even a way to specify a capacity provider strategy for your tasks through the CDK?

Support for capacity providers in CloudFormation (CDK maps to CloudFormation) is incomplete:

For example, when creating an ECS service, you can't explicitly set preferred capacity provider as you can do using CLI's create-service or run-task. Thus you can't specify capacity provider for at service or run-task level.

0
votes

Corresponded with someone from AWS who confirmed that there is no difference between launching a service using the Fargate launch type vs. using 100% FARGATE type capacity providers. Thus, it isn't necessary to add capacity providers to your cluster if you don't plan on using FARGATE_SPOT. Simply using the Fargate launch type is sufficient.

0
votes

With the AWS Fargate Capacity provider, you'll be able to use Fargate SPOT.

This is the main difference between launch a task/service task with and without it.