Search code examples
amazon-web-servicesautoscaling

How do I restart all instances in an autoscaling group?


How do I restart all instances with an autoscaling group? I am not very clear on how to do that.

The goal is the restart the application, when something is not working correctly.


Solution

  • if you application is not working in an asg across all nodes, then a reboot wont solve anything as you are going to bring back up a state of failure on each restart. you need to fix the underlying image, weather that be rebaking or fixing your userdata.

    any restart of an instance in any asg will trigger a termination, and the spawn of a new instance. so, you dont restart machines, you terminate and start new ones.

    to trigger this, there is the 'instance refresh' tab in the asg console, or you can use the cli. Regardless, this wont fix anything until you fix whatever is causing the set of asg's to fail. once you fix the underlying issue in your deployment, then you can trigger an instance refresh, and rotate out the bad configuration.

    https://docs.aws.amazon.com/autoscaling/ec2/userguide/asg-instance-refresh.html