Set the health check grace period for an Auto Scaling group
The health check grace period specifies the minimum amount of time (in seconds) to
keep a new instance in service before terminating if it's unhealthy. A specific use case
might be a requirement to wait to act on Elastic Load Balancing health checks because the instance is
still initializing. The grace period prevents Amazon EC2 Auto Scaling from marking your newly launched
instances unhealthy and terminating them unnecessarily if they do not immediately pass
these health checks after they enter the InService
state.
In the console, by default, the health check grace period is 300 seconds when you create an Auto Scaling group. Its default value is 0 seconds when you create an Auto Scaling group using the AWS CLI or an SDK.
Setting this value too high reduces the effectiveness of the Amazon EC2 Auto Scaling health checks.
If you use lifecycle hooks for instance launch, you can set the health check grace
period to 0. With lifecycle hooks, Amazon EC2 Auto Scaling provides a way to make sure that instances
are always initialized before they enter the InService
state. For more
information, see Amazon EC2 Auto Scaling lifecycle hooks.
The grace period applies to the following instances:
-
Newly launched instances
-
Instances that are put back into service after being in standby
-
Instances that you manually attach to the group
During the health check grace period, if Amazon EC2 Auto Scaling detects that an instance is no
longer in the Amazon EC2 running
state, it immediately marks the instance as
unhealthy and replaces it. For example, if you stop an instance in an Auto Scaling group, it
is marked unhealthy and replaced.
Set the health check grace period for a group
You can set the health check grace period for new and existing Auto Scaling groups.
We strongly recommend also setting the default instance warm-up time for your Auto Scaling group. For a consolidated view of all your instance warm-up, health check grace period, and cooldown settings in one place, see Available warm-up and cooldown settings.