Fargate 服务的启动类型与容量提供策略

Launch Type vs. Capacity Provider Strategy for Fargate Service

我有一个 Fargate 服务 运行 使用 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。我读过一些关于容量提供者的资料,但我不确定我是否真的需要担心它们。据我所知,您可以定义容量提供程序策略来指定不同容量提供程序之间的拆分。对于 Fargate,容量提供程序选择是 FARGATE 和 FARGATE_SPOT。对于我的服务,我只需要 FARGATE 提供商。使用 Fargate 启动类型和使用 100% FARGATE 的容量提供程序策略之间有区别吗?有没有办法通过 CDK 为您的任务指定容量提供者策略?

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

CloudFormation 中对容量提供程序的支持(CDK 映射到 CloudFormation)不完整

例如,在创建 ECS 服务时,您不能像使用 CLI create-service or run-task 那样显式设置 首选容量提供程序。 因此,您不能为服务或 run-task 级别指定容量提供程序。

与来自 AWS 的人员联系,确认使用 Fargate 启动类型启动服务与使用 100% FARGATE 类型容量提供程序之间没有区别。因此,如果您不打算使用 FARGATE_SPOT,则无需将容量提供程序添加到您的集群。只需使用 Fargate 启动类型就足够了。

借助 AWS Fargate Capacity 提供商,您将能够使用 Fargate SPOT。

这是使用和不使用它启动 task/service 任务的主要区别。