Turn on cluster auto scaling - Amazon Elastic Container Service
Services or capabilities described in Amazon Web Services documentation might vary by Region. To see the differences applicable to the China Regions, see Getting Started with Amazon Web Services in China (PDF).

Turn on cluster auto scaling

You can use the Amazon CLI to turn on cluster auto scaling.

Before you begin, create an Auto Scaling group and a capacity provider. For more information, see Amazon EC2 Auto Scaling group capacity providers.

Associate the capacity provider with the cluster

Use the following steps to associate the capacity provider with the cluster.

  1. Use the put-cluster-capacity-providers command to associate one or more capacity providers with the cluster.

    To add the Amazon Fargate capacity providers, include the FARGATE and FARGATE_SPOT capacity providers in the request. For more information, see put-cluster-capacity-providers in the Amazon CLI Command Reference.

    aws ecs put-cluster-capacity-providers \ --cluster ClusterName \ --capacity-providers CapacityProviderName FARGATE FARGATE_SPOT \ --default-capacity-provider-strategy capacityProvider=CapacityProvider,weight=1

    To add an Auto Scaling group for the EC2 launch type, include the Auto Scaling group name in the request. For more information, see put-cluster-capacity-providers in the Amazon CLI Command Reference.

    aws ecs put-cluster-capacity-providers \ --cluster ClusterName \ --capacity-providers CapacityProviderName \ --default-capacity-provider-strategy capacityProvider=CapacityProvider,weight=1
  2. Use the describe-clusters command to verify that the association was successful. For more information, see describe-clusters in the Amazon CLI Command Reference.

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

Turn on managed scaling for the capacity provider

Use the following steps to turn on managed scaling for the capacity provider.

  • Use the update-capacity-provider command to turn on managed auto scaling for the capacity provider. For more information, see update-capacity-provider in the Amazon CLI Command Reference.

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