简体   繁体   中英

How to scale ecs cluster with autoscaling?

I think you have 2 scaling

1 for ec2 instance
1 for ecs task

So I think flow goes like

  • You get more requests
  • Your tasks need more resources (cpu/memory)
  • Your ecs task autoscaling kicks in and creates more task
  • your ec2 autoscaling also kicks in and creates more ec2

Questions

  1. your ecs needs to know newly launched ec2 (from ec2 autoscaling group) is the host that it can run on (how?)
  2. I want the number of ec2 instance starts from one. I think one instance is already running in the ecs cluster Do I make ec2 autoscaling group start from 0?
  3. ec2 autoscaling group has pricing option to use spot instance, but I didn't see such option when I created ecs cluster instances. To be clear, can I make ecs cluster with 0 ecs-instance, and let ec2 autoscaling group starts with 1 instance?

Your ecs task autoscaling kicks in and creates more task your ec2 autoscaling also kicks in and creates more ec2

Your ECS task scale if there is a memory so fine it will scale and launch new container, if not enough memory then it will not launch an instance, you need to configure cloud watch alarm to scale ECS cluster based on the task scaling.

Tutorial: Scaling Container Instances with CloudWatch Alarms

your ecs needs to know newly launched ec2 (from ec2 autoscaling group) is the host that it can run on (how?)

ECS agent registers the new instance with the same cluster, and the new task can be placed in any instance that have available resources to handle and launch the container.

I want the number of ec2 instance starts from one. I think one instance is already running in the ecs cluster Do I make ec2 autoscaling group start from 0?

You should start from 1 otherwise no container will launch and will throw error no instance found in the cluster. if you do not want run container for now then you can start from 0.

ec2 autoscaling group has pricing option to use spot instance, but I didn't see such option when I created ecs cluster instances. To be clear, can I make ecs cluster with 0 ecs-instance, and let ec2 autoscaling group starts with 1 instance?

You can read about spot ECS cluster instance here .

Amazon ECS is a highly scalable, high performance, container management service that supports Docker containers and allows you to run applications on a managed cluster of Amazon EC2 instances easily. ECS already handles the placement and scheduling of containers on EC2 instances. When combined with Spot fleet, ECS can deliver significant savings over EC2 on-demand pricing.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM