首页 > 解决方案 > ECS部署及匹配运行任务数

问题描述

场景:ECS Fargate。
假设我有 2 个任务的“期望计数”。

系统承担一些负载并自动扩展到 6 个任务。

如果我在这段时间部署,ECS 似乎会将我的实际运行能力降低到 2 个任务。这会导致服务失败,因为系统无法再处理实际负载,现在必须扩大规模。我遇到的所有文档都表明使用“最小健康百分比”和“最大百分比”来帮助控制部署规模,但这些都是指返回的任务数量,而不是实际部署到的实际系统上运行的实际数量。

知道是否有办法说:“请匹配正在运行的任务数量,或者在从部署中启动新任务时匹配其中的某个百分比”?

通过 CodePipeline 部署是 Cloudformation。

标签: amazon-web-servicesamazon-ecsaws-fargate

解决方案


CFN 中的DesiredCount参数现在是可选的。有关背景,请参阅此问题

从问题:

We are making following improvements to ECS integration with Cloudformation:

    - DesiredCount becomes an optional field in CFN CreateService and DesiredCount=1 would be used as the default value if it is missing
    - UpdateService will also omit DesiredCount when it is missing in CFN template

Customers expect the current behavior (i.e. UpdateService will use the set DesiredCount in the CFN template) can just add DesiredCount in their CFN templates. Existing customers wanting the new behavior can get it by removing DesiredCount from their CFN templates. The changes will be released soon.

推荐阅读