How do I reboot an instance in an Amazon EC2 Auto Scaling group?

5 minute read
0

My Amazon Elastic Compute Cloud (Amazon EC2) instance is part of an Amazon EC2 Auto Scaling group. I want to reboot the instance without Amazon EC2 Auto Scaling terminating it due to health check failure.

Short description

If you stop and start an instance in the InService state in an Amazon EC2 Auto Scaling group, then EC2 Auto Scaling stops the instance. Amazon EC2 Auto Scaling does this because the instance fails health checks when it reaches the Stopping or Stopped states during a reboot.

Use the following procedures to start and stop the instance without the instance marked as Unhealthy:

  • Put the instance into the Standby state.
  • Detach the instance from the group.
  • Suspend the health check process.

Resolution

Put the instance into the Standby state

To reboot an instance in an Amazon EC2 Auto Scaling group, first put the instance into the Standby state. Amazon EC2 Auto Scaling doesn't perform health checks on instances in the Standby state. Choose this option if you need the Amazon EC2 Auto Scaling group to manage the instance throughout the process. You must choose this option when there is an Auto Scaling group that manages instances in a Standby state.

To put the instance into a Standby state, reboot the instance, and then return the instance to service, follow these steps:

  1. Open the Amazon EC2 console.
  2. In the navigation pane, under Auto Scaling, choose Auto Scaling Groups.
  3. On the Instance management view, select the instance you want to reboot.
  4. Choose Actions, and then choose Set to Standby.
  5. On the Set to Standby page, type standby to agree, and then click Set to Standby.

Note: Optionally, you can select Replace instance to maintain the group capacity, this launches a new replacement instance. If you don't want to launch new replacement instance, then deselect the Replace instance.

  1. Choose the instance that you set to the Standby state, and then redirect it to the EC2 page. Choose Instance State, and then choose Reboot.
  2. Choose the Status and alarms tab. Confirm that the System Status Checks and Instance Status Checks pass.
  3. In the Auto Scaling page, select the group of the instance that you set to the Standby state.
  4. Under the Instance management tab, select the instance that you rebooted. Choose Actions, and then choose Set to InService.
  5. On the Set to InService page, choose Set to InService.

Detach the instance from the group

You can detach an instance from an Amazon EC2 Auto Scaling group to manage the instance separately from its EC2 Auto Scaling group. After you reboot the instance, you can attach the instance to an Amazon EC2 Auto Scaling group again, or you can leave the instance unattached.

To detach the instance from the Amazon EC2 Auto Scaling group, reboot the instance, and then reattach the instance to the group, follow these steps:

  1. Open the Amazon EC2 console.
  2. In the navigation pane, under Auto Scaling, choose Auto Scaling Groups.
  3. Select the group of the instance that you want to reboot. On the Instances management view, select the instance you want to reboot.
  4. Choose Actions, and then choose Detach.
  5. On the Detach Instance page, type detach to agree and then choose Detach Instance.
    Note: Optionally, you can choose Replace instance to launch new replacement instance.
  6. Go to the EC2 page and find the detached instance. Choose Instance State, and then choose Reboot.
  7. Choose the Status and alarms tab, confirm that the System Status Checks and Instance Status Checks pass.
  8. Select the rebooted instance, choose Actions, choose Instance Settings, and then choose Attach to Auto Scaling Group.
  9. For Attach to Auto Scaling Group, under Auto Scaling Group, choose an existing Auto Scaling group. Then, choose Attach.

Suspend the health check process

You can suspend the health check process for your Auto Scaling group to reboot instances without Amazon EC2 Auto Scaling stopping the instances.

Warning: Suspending a process affects all instances in an Auto Scaling group. Until you resume the process, Amazon EC2 Auto Scaling doesn't replace any unhealthy instances. If you need Amazon EC2 Auto Scaling to perform health checks on remaining instances, choose one of the previous options.

To suspend the health check process for your group, reboot an instance, and then resume the health check process for the group, follow these steps:

  1. In the Amazon EC2 navigation pane, under Auto Scaling, choose Auto Scaling Groups, and then select the instance's group.
  2. Choose the Details view.
  3. Check the Suspended processes under the Advanced configurations section, and then choose Edit.
  4. Under Suspended Processes, select HealthCheck, and then choose Update.
  5. Go to the EC2 page and select the instance that you reboot. Choose Actions, select Instance State, and then choose Reboot.
  6. Choose the Status and alarms tab. Confirm that the System Status Checks and Instance Status Checks pass.
  7. Go to the Auto Scaling page and select the group of the instance that you rebooted.
  8. On the Details tab, check the Suspended processes under the Advanced configurations section, and then choose Edit.
  9. Under Suspended Processes, remove HealthCheck, and then choose Update.

Related information

How do I delay the termination of an unhealthy Amazon EC2 instance so that I can troubleshoot issues?

AWS OFFICIAL
AWS OFFICIALUpdated 2 months ago