---
title: "Auto Scaling replaces new instances for failing ELB health checks | Proofline"
description: "When new instances are terminated soon after launch, the termination activity's cause text names the health check that removed them: ELB or EC2 status."
url: https://proofline.sh/learn/asg-elb-health-check-replaces-new-instances/
---

[Learning center](/learn/)

# Auto Scaling replaces new instances for failing ELB health checks

When new instances are terminated soon after launch, the termination activity's cause text names the health check that removed them: ELB or EC2 status. For an ELB replacement, compare the group's grace period with how long a new target takes to pass its first checks. A target that would pass a few minutes later points at the grace period; a target that never passes while old instances stay healthy points at the release.

Deployment failures The Proofline team November 22, 2026 7 min read

## Read the cause text first

Every replacement leaves two scaling activities: one terminating the unhealthy instance and one launching its replacement. The termination activity's `Cause` names the check. AWS's troubleshooting page for health check replacements is organized by these texts. [Unhealthy instance replacement](https://docs.aws.amazon.com/autoscaling/ec2/userguide/ec2-auto-scaling-health-checks.html) · [Troubleshoot unhealthy instances](https://docs.aws.amazon.com/autoscaling/ec2/userguide/ts-as-healthchecks.html)

| Cause contains | Check that failed | First read |
| --- | --- | --- |
| `an instance was taken out of service in response to an ELB system health check failure` | A load balancer target group reported the instance unhealthy | Group grace period and target health |
| `an instance was taken out of service in response to an EC2 instance status check failure` | EC2 status checks reported the instance impaired | Instance and system status |
| `an instance was taken out of service in response to an EC2 health check that indicated it had been terminated or stopped` | The instance left the `running` state | Whether the instance shut itself down or someone stopped it |

The first row happens only when the group's health check type includes `ELB`. By default a group ignores load balancer results; EC2 status checks are always on. With several target groups attached, any one reporting the instance unhealthy is enough for replacement. [Elastic Load Balancing health checks](https://docs.aws.amazon.com/autoscaling/ec2/userguide/ec2-auto-scaling-health-checks.html) · [CreateAutoScalingGroup](https://docs.aws.amazon.com/autoscaling/ec2/APIReference/API_CreateAutoScalingGroup.html)

Use a read-only profile and replace the uppercase placeholders. [describe-scaling-activities](https://docs.aws.amazon.com/cli/latest/reference/autoscaling/describe-scaling-activities.html)

```
aws autoscaling describe-scaling-activities \
  --profile PROFILE --region REGION --auto-scaling-group-name GROUP \
  --query 'Activities[:30].{start:StartTime,end:EndTime,status:StatusCode,description:Description,cause:Cause}' \
  --output json --no-cli-pager
```

Pair each terminated instance's launch with its termination by the instance ID in `Description`. The gap between the two start times is the first number to compare with the grace period.

## Read the grace period and the target group's thresholds

```
aws autoscaling describe-auto-scaling-groups \
  --profile PROFILE --region REGION --auto-scaling-group-names GROUP \
  --query 'AutoScalingGroups[0].{type:HealthCheckType,grace:HealthCheckGracePeriod,warmup:DefaultInstanceWarmup,targetGroups:TargetGroupARNs,instances:Instances[].{id:InstanceId,state:LifecycleState,health:HealthStatus,version:LaunchTemplate.Version}}' \
  --output json --no-cli-pager

aws elbv2 describe-target-groups \
  --profile PROFILE --region REGION --target-group-arns TARGET_GROUP_ARN \
  --query 'TargetGroups[0].{path:HealthCheckPath,port:HealthCheckPort,interval:HealthCheckIntervalSeconds,timeout:HealthCheckTimeoutSeconds,healthyAfter:HealthyThresholdCount,unhealthyAfter:UnhealthyThresholdCount,codes:Matcher.HttpCode}' \
  --output json --no-cli-pager
```

The grace period is the time Auto Scaling waits after an instance enters `InService` before it acts on a failed health check. The load balancer starts checking earlier, when the instance registers. A group created in the console gets 300 seconds by default; a group created with the CLI or an SDK gets 0. How long the checks take depends on the target's state. AWS says a newly registered target must pass one health check to be considered healthy. A target that fails `UnhealthyThresholdCount` checks first, because the application is still starting, turns `unhealthy`, and then needs `HealthyThresholdCount` consecutive successes to recover. For HTTP target groups the defaults are two failures to turn unhealthy and five successes to recover, at a 30-second interval, so an application that takes more than a minute to answer needs about two and a half more minutes of passing checks. [Health check grace period](https://docs.aws.amazon.com/autoscaling/ec2/userguide/health-check-grace-period.html) · [Target group health checks](https://docs.aws.amazon.com/elasticloadbalancing/latest/application/target-group-health-checks.html) · [Troubleshoot unhealthy instances](https://docs.aws.amazon.com/autoscaling/ec2/userguide/ts-as-healthchecks.html) · [CreateTargetGroup](https://docs.aws.amazon.com/elasticloadbalancing/latest/APIReference/API_CreateTargetGroup.html)

That gives a rough budget. If the application answers before the target has failed `UnhealthyThresholdCount` checks, it is boot time, plus application start, plus one `HealthCheckIntervalSeconds`. If it answers later, add `HealthyThresholdCount` times the interval instead. A grace period under that budget replaces instances that would have become healthy, and one far above it only delays replacing instances that are really broken.

## Watch a new target before it is replaced

Read target health for the new instance IDs while they are still registered, and compare them with the old instances in the same target group. [describe-target-health](https://docs.aws.amazon.com/cli/latest/reference/elbv2/describe-target-health.html) · [TargetHealth](https://docs.aws.amazon.com/elasticloadbalancing/latest/APIReference/API_TargetHealth.html)

```
aws elbv2 describe-target-health \
  --profile PROFILE --region REGION --target-group-arn TARGET_GROUP_ARN \
  --query 'TargetHealthDescriptions[].{target:Target.Id,port:Target.Port,state:TargetHealth.State,reason:TargetHealth.Reason,description:TargetHealth.Description}' \
  --output table --no-cli-pager
```

`Elb.InitialHealthChecking` at the moment of replacement means the load balancer had not finished deciding. `Target.Timeout`, `Target.FailedHealthChecks` or `Target.ResponseCodeMismatch` on new targets while old targets stay healthy means the new instances answered badly or not at all.

To see whether a target would pass if left alone, keep one replacement alive. This is a change: suspending the `ReplaceUnhealthy` process stops the group from replacing unhealthy instances until you resume it, which AWS recommends when you do not want instances replaced. Resume it when you have the answer. [Health check considerations](https://docs.aws.amazon.com/autoscaling/ec2/userguide/ec2-auto-scaling-health-checks.html) · [suspend-processes](https://docs.aws.amazon.com/cli/latest/reference/autoscaling/suspend-processes.html)

```
# Change: pauses health replacement for the whole group.
aws autoscaling suspend-processes \
  --profile PROFILE --region REGION --auto-scaling-group-name GROUP \
  --scaling-processes ReplaceUnhealthy

# Change: restores health replacement.
aws autoscaling resume-processes \
  --profile PROFILE --region REGION --auto-scaling-group-name GROUP \
  --scaling-processes ReplaceUnhealthy
```

For the EC2 rows of the table, read status checks instead. Auto Scaling tolerates an occasional `impaired` result and waits a few minutes, but treats an instance outside `running` as an immediate failure, even during the grace period. [describe-instance-status](https://docs.aws.amazon.com/cli/latest/reference/ec2/describe-instance-status.html) · [Amazon EC2 health checks](https://docs.aws.amazon.com/autoscaling/ec2/userguide/ec2-auto-scaling-health-checks.html)

```
aws ec2 describe-instance-status \
  --profile PROFILE --region REGION --instance-ids INSTANCE_ID --include-all-instances \
  --query 'InstanceStatuses[].{id:InstanceId,state:InstanceState.Name,instance:InstanceStatus.Status,system:SystemStatus.Status}' \
  --output json --no-cli-pager
```

## What the reads mean

| Cause | New target, kept alive | Old targets | Reading |
| --- | --- | --- | --- |
| ELB | Passes a few minutes after it would have been replaced | Healthy | Grace period shorter than boot, start and the checks the target needs |
| ELB | Never passes; `ResponseCodeMismatch` or `Timeout` | Healthy | The release: application, user data, port or network of the new version |
| ELB | Never passes | Failing too | Health check settings, the load balancer's path to instances, or a dependency the check calls |
| EC2 status check | Any | Any | Instance or system impairment; the load balancer is not involved |
| Terminated or stopped | Any | Any | The instance left `running`, for example a shutdown from its own operating system |

For the third row on a Network Load Balancer, the security group path is one lead to check: see [NLB targets unhealthy after a security group change](/learn/nlb-targets-unhealthy-security-group/). If targets pass but clients see gateway timeouts, the problem has moved to routing: see [ALB 504 after a deploy](/learn/alb-504-after-deploy/).

## A fictional fixture

The group `orders-asg` was created with the CLI, uses `ELB` health checks and has a grace period of 60 seconds. The `orders` service takes about four minutes to start, and the target group uses the HTTP defaults. Version 8 of the launch template starts rolling out at 10:00.

At 10:03 the first new instance is terminated with the ELB cause text. Target health read at 10:02 showed `initial` with `Elb.InitialHealthChecking`. With `ReplaceUnhealthy` suspended, the next new instance turns `healthy` at 10:07, and the old instances stayed healthy throughout. The application took four minutes to answer, so each target failed two checks first, turned `unhealthy` and needed five successes to recover: about four minutes of start plus two and a half minutes of checks, so 60 seconds could never work. Raising the grace period to around 420 seconds, or adding a launch lifecycle hook that completes once the service answers, fixes the rollout.

In a second version of the same morning, the kept instance shows `Target.ResponseCodeMismatch` with code 500 for fifteen minutes while version 7 instances stay healthy. A longer grace period would only delay each replacement. Roll back version 8 and read its application logs.

## Fix and confirm

Raise the grace period with `update-auto-scaling-group --health-check-grace-period`, a change, to cover the budget above. AWS also suggests a launch lifecycle hook: the instance registers with the load balancer only when the hook completes, and with a launch hook AWS says the grace period can be 0. Set the default instance warmup as well, which AWS strongly recommends alongside the grace period. Keep the grace period no longer than needed; AWS notes that a high value reduces the effectiveness of health checks. If you use a hook, check that it completes, as [the lifecycle hook guide](/learn/asg-lifecycle-hook-timeout-abandon/) describes. [Health check grace period](https://docs.aws.amazon.com/autoscaling/ec2/userguide/health-check-grace-period.html) · [Lifecycle hooks](https://docs.aws.amazon.com/autoscaling/ec2/userguide/lifecycle-hooks.html) · [Default instance warmup](https://docs.aws.amazon.com/autoscaling/ec2/userguide/ec2-auto-scaling-default-instance-warmup.html)

On the next rollout, confirm that each new target reaches `healthy`, no termination activity carries the ELB cause text, and `HealthStatus` on the new instances stays `Healthy`. Resume `ReplaceUnhealthy` if you suspended it.

## Where this reading stops

Target health is a snapshot of targets registered now; a replaced instance has already left it. The cause text names the check, not why the check failed. When every instance is reported unhealthy by the load balancer, AWS says the group may replace fewer of them at a time than its usual 10 percent, so a slow trickle of replacements can mean everything is failing. For the other scaling and health signatures, see [the signature table](/learn/aws-deployment-failure-signatures/), and for a refresh that failed because new instances never became healthy, see [instance refresh failures](/learn/asg-instance-refresh-failed/). [How Auto Scaling minimizes downtime](https://docs.aws.amazon.com/autoscaling/ec2/userguide/ec2-auto-scaling-health-checks.html)

## Questions

### How long should the health check grace period be for an Auto Scaling group with ELB health checks?

Long enough for boot, application start and the checks the target then needs. A newly registered target needs one passing check. If it failed enough checks while starting to turn unhealthy, it needs the healthy threshold times the interval, which with HTTP defaults is about two and a half minutes after the application first answers.

### What is the difference between an ELB health check failure and an EC2 status check failure in Auto Scaling?

An ELB failure means a target group reported the instance unhealthy, and it applies only when the group's health check type includes ELB. An EC2 status check failure means EC2 found the instance or its host impaired, and it applies to every group.

### Will a longer grace period fix new instances that fail health checks?

Only if they would pass later. Keep one new instance alive and watch its target health; if it never passes while old instances stay healthy, the release is the cause and a longer grace period only delays each replacement.

## One month of free code review.

New organizations get one calendar month of hosted code review for private and public GitHub repositories. No card or cloud connection required. [Eligibility and fair-use terms](/free-code-review/).

[Start free with GitHub](https://proofline.sh/orgs/plan?offer=free_month)

## Related reading

-   ### [Auto Scaling lifecycle hook abandoned the launch: timeout or ABANDON call?](/learn/asg-lifecycle-hook-timeout-abandon/)
    
    Deployment failures The Proofline team November 22, 2026 6 min read
    
-   ### [EC2 Auto Scaling instance refresh failed, cancelled or rolled back](/learn/asg-instance-refresh-failed/)
    
    Deployment failures The Proofline team November 22, 2026 6 min read
