0
votes

We have an application to create/start/stop containers inside AWS ECS. we are not making use of ecs services because we don't want container to be started if it is stopped by an application.

So how to automate scale-in/scale-out of the cluster instances in ecs without using ecs services?

1
Can you explain further your use case? It seems like ECS is not for your use case.sayboras

1 Answers

0
votes

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 :

  1. Say you have one Container Instance and 2 services running on it.
  2. You are required to increase the ECS Service but it will not scale as it doesn't have resources available on one Container Instance.
  3. Following up the documentation, you can set up CloudWatch Alarms on let's say MemoryReservation metric for your cluster.
  4. 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.