关闭 Amazon ECS 集群自动扩缩 - Amazon Elastic Container Service
Amazon Web Services 文档中描述的 Amazon Web Services 服务或功能可能因区域而异。要查看适用于中国区域的差异,请参阅 中国的 Amazon Web Services 服务入门 (PDF)

关闭 Amazon ECS 集群自动扩缩

当需要对注册到您的集群的 EC2 实例进行更精细的控制时,可以关闭集群自动扩缩功能。

要关闭集群的集群自动扩缩,您可以在集群中取消容量提供程序与启用的托管式扩缩的关联,也可以更新容量提供程序以关闭托管式扩缩。

取消容量提供程序的关联

按照以下步骤将容量提供程序与取消集群关联。

  1. 使用 put-cluster-capacity-providers 命令来取消自动扩缩组容量提供程序与集群的关联。集群可以与 Amazon Fargate 容量提供程序保持关联。有关更多信息,请参阅 Amazon CLI 命令参考 中的 put-cluster-capacity-providers

    aws ecs put-cluster-capacity-providers \ --cluster ClusterName \ --capacity-providers FARGATE FARGATE_SPOT \ --default-capacity-provider-strategy '[]'

    使用 put-cluster-capacity-providers 命令来取消自动扩缩组容量提供程序与集群的关联。有关更多信息,请参阅 Amazon CLI 命令参考 中的 put-cluster-capacity-providers

    aws ecs put-cluster-capacity-providers \ --cluster ClusterName \ --capacity-providers [] \ --default-capacity-provider-strategy '[]'
  2. 使用 describe-clusters 命令以验证取消关联是否成功。有关更多信息,请参阅 Amazon CLI 命令参考 中的 describe-clusters

    aws ecs describe-clusters \ --cluster ClusterName \ --include ATTACHMENTS

为容量提供程序关闭托管扩缩

按照以下步骤关闭容量提供程序的托管扩缩。

  • 使用 update-capacity-provider 命令以为容量提供程序关闭托管自动扩缩。有关更多信息,请参阅 Amazon CLI 命令参考 中的 update-capacity-provider

    aws ecs update-capacity-provider \ --capacity-providers CapacityProviderName \ --auto-scaling-group-provider managedScaling=DISABLED