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
demandé il y a 2 ans576 vues
2 réponses
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
répondu il y a 2 ans
  • 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
répondu il y a 2 ans
  • Target tracking doesn't allow the alarms or scaling amounts to be customized, so it wouldn't meet the requirements

Vous n'êtes pas connecté. Se connecter pour publier une réponse.

Une bonne réponse répond clairement à la question, contient des commentaires constructifs et encourage le développement professionnel de la personne qui pose la question.

Instructions pour répondre aux questions

Contenus pertinents