mercredi 29 avril 2015

How to configure EC2 autoscaling based on multiple limits on same metric?

My primary requirement is as follows:

When CPU consumption on an instance exceeds 50 % then adjust capacity of autoscaling group to 5 instances, when CPU consumption exceeds 80% then adjust capacity to 10 instances.

However if I use cloudwatch alarms to set capacity I can imagine the following race condition:

  • 5 instances exist
  • CPU consumption exceeds 80 %
  • Alarm is triggered
  • Capacity is changed to 19 instances
  • CPU consumption drops below 50 %
  • Eventually CPU consumption again exceeds 50% but now capacity will be changed to 5 instances (which is something I don't want to happen)

So what I would ideally like to happen is that in response to alarm triggers I would like to ensure that capacity is altleast the corresponding threshold.

I am aware that this can be done by manually setting the capacity through AWS SDK - which could be triggered in response to lifecycle events monitored by a supervisor, but is there a better approach, preferably one that does not require setting up additional supervisors or webhooks for alarms ?




Aucun commentaire:

Enregistrer un commentaire