Auto scaling group: Terminate burstable instance with lowest CPU credit balance first



How can we update our Elastic Beanstalk environment to terminate - during an automatic down-scaling event - the instance with the lowest amount of CPU credit balance?

Currently, when scaling down, it terminates the oldest instance, leaving new instances in place that may have only just started to accumulate CPU credits.

Thank you for any help in this regard.

1 Answer

ASG's support setting a custom termination policy for changing which instances are selected for termination when a scale in event occurs - Beanstalk does not provide a way to override this setting to OldestInstance or the most relevant policy. It only allows for a small subset of settings on the ASG to be adjusted

answered 3 months ago
  • Is there a termination policy that considers the CPU credit balance?

  • Not one of the build in ones, you'd need to create a Lambda function and use a custom policy as lp901 mentioned. You could change to using the built in "NewestInstance" policy instead of making a custom one, but that isn't guaranteed to get rid of instances with the fewest credits

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions