Turning on Amazon ECS cluster auto scaling
You turn on cluster auto scaling so that Amazon ECS manages the scaling of Amazon EC2 instances that are registered to your cluster.
Before you begin, create an Auto Scaling group and a capacity provider. For more information, see Amazon ECS capacity providers for the EC2 launch type .
To turn on cluster auto scaling, you associate the capacity provider with the cluster, Then you turn on cluster auto scaling.
-
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
andFARGATE_SPOT
capacity providers in the request. For more information, seeput-cluster-capacity-providers
in the Amazon CLI Command Reference.aws ecs put-cluster-capacity-providers \ --cluster
ClusterName
\ --capacity-providersCapacityProviderName
FARGATE FARGATE_SPOT \ --default-capacity-provider-strategy capacityProvider=CapacityProvider,weight=1To 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-providersCapacityProviderName
\ --default-capacity-provider-strategy capacityProvider=CapacityProvider,weight=1 -
Use the
describe-clusters
command to verify that the association was successful. For more information, seedescribe-clusters
in the Amazon CLI Command Reference.aws ecs describe-clusters \ --cluster
ClusterName
\ --include ATTACHMENTS -
Use the
update-capacity-provider
command to turn on managed auto scaling for the capacity provider. For more information, seeupdate-capacity-provider
in the Amazon CLI Command Reference.aws ecs update-capacity-provider \ --capacity-providers
CapacityProviderName
\ --auto-scaling-group-provider managedScaling=ENABLED