Skip to content

Scaling ECS Container Instances

Daniel Kang edited this page Oct 24, 2016 · 4 revisions

Supported Scaling Types

Manual Scaling

User can set the desired capacity (the number of container instances in ECS cluster).

Automatic Scaling

User defines criteria to determine when/how to scale the container instances in ECS cluster.

This is not implemented in the current version.

Scaling Procedures

Scaling In

Current implementation simply set the desired capacity of auto scaling group to the target, and, it may cause reduced number of running tasks in some services. As long as ESC Cluster has sufficient capacity, they will recover soon, but, some services will have reduced number of tasks running until it fully recovers.

Ideally, better scaling in procedure should be implemented in the following steps: (E.g. need to remove container instance C1 which is running tasks for S1 and S2.)

  • Deregister C1 from ECS cluster (use --force option to keep tasks running)
  • Tasks for S1 and S2 are still running in C1, but, ECS cluster will try to start tasks for S1 and S2 in other container instances.
  • Once services S1 and S2 become stable status (desired tasks == running tasks), stop all tasks in C1. Detach C1 from auto scaling group (use --should-decrement-desired-capacity)
  • Terminate C1. For multiple container instances, simply repeat these steps for each instances.

Scaling Out

E.g. need to add N container instances.

  • Increment desired capacity of auto scaling group by N.