简体   繁体   中英

AWS ECS Cluster Autoscaling

I am trying to setup a scaling policy in ECS Cluster, so that EC2 instance that make up ECS cluster and task runnning in ECS Service could scale up and down based on the scalling policy i specified. I had created 2 cloud watch alarm for that, which will check CPUUtilization resource.

1) HIGH_CPU_Usage : Whenever >= 80 %
2) LOW_CPU_Usage : Whenever <= 40 %
  • Configured ECS auto scaling to scale up task when "HIGH_CPU_Usage" triggered.
  • Configured ECS auto scaling to scale down task when "LOW_CPU_Usage" triggered.
  • Configured EC2 Auto scaling to scale up EC2 instance when "HIGH_CPU_Usage" triggered.
  • Configured EC2 Auto scaling to scale down EC2 instance when "LOW_CPU_Usage" triggered.

Can any on please help me out to understand solution for below points .

1) When "HIGH_CPU_Usage" alarm trigger, will both EC2 instance and ECS task scale up event occur simultaneously. Will the task scale up event wait for the ec2 instance scale up event to complete.

2) If EC2 instance scale up event take more time to complete and in same time ECS task scale up event find no available resource in the cluster, what will happen.

3) If CPU load spiking up and down, Instance scale up and scale down occur multiple time and it will cause huge billing . Is there any way to solve these

You are talking about ec2 autoscaling and task(container) autoscaling . This two autoscaling is independent of each other and you can't control these two from a single source like you are trying with a single cloud watch alert.

Please find below answers for your points.

1) When "HIGH_CPU_Usage" alarm trigger, will both EC2 instance and ECS task scale up event occur simultaneously. Will the task scale up event wait for the ec2 instance scale up event to complete.

Answer - Yes both events occur simultaneously as they are independent of each other and no one waits for each other.

2) If EC2 instance scale up event take more time to complete and in same time ECS task scale up event find no available resource in the cluster, what will happen.

Answer - Then ECS task scale-up failed as there is no resource for scaling. But it will try again after one minute until service is not in the desired state.

3) If CPU load spiking up and down, Instance scale up and scale down occur multiple time and it will cause huge billing. Is there any way to solve these.

Answer - Use request base autoscaling or read below docs for more details.

https://aws.amazon.com/blogs/compute/automatic-scaling-with-amazon-ecs/

https://docs.aws.amazon.com/AmazonECS/latest/developerguide/cloudwatch_alarm_autoscaling.html

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