I want to temporarily remove Amazon Elastic Compute Cloud (Amazon EC2) instances from my Amazon EC2 Auto Scaling group so that I can troubleshoot or update them.
Resolution
You can't stop, start, or reboot EC2 instances that are in the InService state in an Auto Scaling group without first terminating the instance. Use one of the following methods to troubleshoot or perform updates that require stopping, starting, or rebooting the instance:
Temporarily remove an instance
You can temporarily remove an instance by setting it to the Standby state. To do this, see the following:
Temporarily remove an instance (console)
Temporarily remove an instance AWS Command Line Interface (AWS CLI))
After initiating the Standby state, perform troubleshooting or updating tasks. When you are done troubleshooting, return the instance to the InService state.
Suspend the Terminate and HealthCheck processes
- Open the EC2 console and then choose Auto Scaling groups from the navigation pane.
- Choose the Auto Scaling group where the affected instance is located.
- Select Advanced configurations, Edit.
- Under Suspended processes, select the check boxes next to Terminate and HealthCheck, and then choose Update.
Important: Suspend both the Terminate and HealthCheck processes. If HealthCheck isn't selected, then the instance shows as unhealthy when the instance is stopped or rebooted. And, when you resume the Terminate process, Auto Scaling replaces the instance because of the failed health check.
- Complete troubleshooting or updating tasks.
- On the Auto Scaling Groups page, select the Auto Scaling group. Then, scroll down to Advanced configurations and choose Edit
- For Suspended processes, uncheck the Terminate and HealthCheck processes, and then choose Update.
Follow these instructions to suspend the Terminate and HealthCheck processes using the AWS CLI:
Note: If you receive errors when running AWS CLI commands, make sure that you're using the most recent version of the AWS CLI.
1. Use the aws autoscaling suspend-processes command to suspend the Auto Scaling processes. In the following example command, replace [X] with the name of your Auto Scaling group.
aws autoscaling suspend-processes --auto-scaling-group-name [X] --scaling-processes Terminate HealthCheck
2. Perform your troubleshooting or updating tasks.
3. Use the aws autoscaling resume-processes command to resume the processes. In the following example command, replace [X] value with the name of your Auto Scaling group.
aws autoscaling resume-processes --auto-scaling-group-name [X] --scaling-processes Terminate HealthCheck
Related information
Suspend and resume a process for an Auto Scaling group