EC2 Auto Scaling

0

I need to set a auto scaling group and the requirement is , if CPU utilisation goes above 50% for 5 minutes then it should add New instance and if CPU utilisation drops below 50% for 5 minutes then it should delete 1 instance.

Please advise.

DBWS
已提问 2 年前576 查看次数
2 回答
1

You will need to use step scaling to have control over both the alarms and number of instances added/removed (the amount the desired capacity will be changed by the policy). Target tracking will dynamically decide how much capacity to add or remove based on the specific state of the group and metric at any given time; and does not allow you to customize the alarm settings. So while target tracking does work very well for the majority of use cases, if you have a hard requirement for your environment to only add/remove 1 instance at a time with a 5 minute alarm, then it won't work for you.

I highly recommend not setting both the scale-in and scale-out thresholds to 50% though, you should leave a gap between them to prevent oscillation. For example: lets say you have 3 instances, and the CPU goes to 60%, triggering the +1 step scaling policy. If the load stays constant, it will now be distributed to all 4 instances and the average CPU will drop to around 45% and the scale-in alarm will go off. This will then keep happening in a loop until the load goes up or down enough for one of the alarms to stay in the alarm state and the ASG reaches the min or max

AWS
已回答 2 年前
  • Also, best practice is to scale up fast, and scale down slow. You don't want to be stuck where you need the instance you just removed.

0

Hi, you could use ASGAverageCPUUtilization to "Create a target tracking scaling policy (console)" as per https://docs.aws.amazon.com/autoscaling/ec2/userguide/as-scaling-target-tracking.html#available-metrics You could create a scale-out and scale-in depending on the CPU utilisation

profile picture
Sri
已回答 2 年前
  • Target tracking doesn't allow the alarms or scaling amounts to be customized, so it wouldn't meet the requirements

您未登录。 登录 发布回答。

一个好的回答可以清楚地解答问题和提供建设性反馈,并能促进提问者的职业发展。

回答问题的准则