Below is the documentation which will tell you step by step how to scale your container instances.
Scaling Container Instances
So how this works is :
- Say you have one Container Instance and 2 services running on it.
- You are required to increase the ECS Service but it will not scale as it doesn't have resources available on one Container Instance.
- Following up the documentation, you can set up CloudWatch Alarms on let's say
MemoryReservation
metric for your cluster.
- When the memory reservation of your cluster rises above 75% (meaning that only 25% of the memory in your cluster is available to for new tasks to reserve), the alarm triggers the Auto Scaling group to add another instance and provide more resources for your tasks and services.
Depending on the Amazon EC2 instance types that you use in your
clusters, and quantity of container instances that you have in a
cluster, your tasks have a limited amount of resources that they can
use while running. Amazon ECS monitors the resources available in the
cluster to work with the schedulers to place tasks. If your cluster
runs low on any of these resources, such as memory, you are eventually
unable to launch more tasks until you add more container instances,
reduce the number of desired tasks in a service, or stop some of the
running tasks in your cluster to free up the constrained resource.