Reputation: 3710
Is there a effective way how to set-up rule in AWS auto-scaling group to terminate instances which are under given % of CPU ?
We are using autoscaling for bunch of EC2 instances - quite intensive computations over the night so CPUs are burning or doing nothing (if incoming task queue is empty).
Monitoring rules allows you to monitor average CPU (for whole group) but we have quite often few instances which are finished and there's nothing much to do (if incoming task queue is empty).
Example :
Rule #2 : scale up if average CPU > 80%
15 instances running in total :
Average CPU for whole group : 58 % - this will not trigger 'scale down' rule, is there a way how to optimize rules within auto-scaling group to deal with this problem ?
Thank you
Upvotes: 3
Views: 1713
Reputation: 1451
You could use the minimum CPU usage of the Auto-Scaling Group, rather than the average. Scale down if the minimum CPU usage of the group is less than (say) 10% This will terminate the 3 idling instances in your example, leaving the other 12 fully loaded instances alone.
Upvotes: 2
Reputation: 26
You can setup a cron job which will periodically check the individual CPU usage of the ec2 instances and terminate those instances which are below a certain threshold.
Upvotes: 0