Skip to content

my ec2 instance is not replaced in alb when the app is down

0

I created an EB environment but attach it with an ALB that was created manually. I then installed an java app installed in EC2 instances of this eb environment. The ASG is auto created when the eb is built. This ASG has correct heathcheckpath. Also I set "Load balancer target groups" to the ALB target group created above for this ASG. Max instance size is 2 and minimum instance is 1. I also set Health check type both: EC2, ELB in the ASG above I then stop my app in the EC2 instance. I saw that in the Environment Overview, the Health status is "Degraded". However the instance is not replaced Could you please help

asked a year ago231 views

3 Answers
0

The issue you're experiencing is related to how health checks are configured in your Elastic Beanstalk environment and how they interact with Auto Scaling.

By default, even when an application crashes or becomes unresponsive, if the EC2 instance itself is still healthy (passing EC2 status checks), Amazon EC2 Auto Scaling won't automatically replace it. This is actually the intended default behavior, which allows for troubleshooting rather than immediately replacing instances.

There are a few key points to check:

  1. While you've set the health check type to both EC2 and ELB in your Auto Scaling group, configuring a health check URL alone doesn't change the health check behavior of your environment's Auto Scaling group. You need to explicitly configure the Auto Scaling group to use ELB health checks as a basis for replacing instances.

  2. You need to ensure that the health check configuration in your ALB target group is properly set up to detect your application's health status, not just the instance health.

  3. The "Degraded" status in your environment indicates that the health check is detecting the issue, but the Auto Scaling group isn't taking action to replace the instance.

To fix this issue, you should:

  1. Configure your Auto Scaling group to use ELB health checks for instance replacement. This can be done using a configuration file (.ebextensions) in your Elastic Beanstalk environment with settings like:
Resources:
AWSEBAutoScalingGroup:
Type: "AWS::AutoScaling::AutoScalingGroup"
Properties:
HealthCheckType: ELB
HealthCheckGracePeriod: 300
  1. Ensure that your ALB health check is properly configured to check the actual health of your application, not just the instance.

  2. Verify that the security groups and network configuration allow the health check traffic between the ALB and your instances.

One user with a similar issue resolved it by switching from a Network Load Balancer to an Application Load Balancer and configuring the health check properly for the ALB so that it matched the check for autoscaling.
Sources
Amazon EC2 Auto Scaling health check setting for your Elastic Beanstalk environment - AWS Elastic Beanstalk
ElasticBeanstalk stuck | AWS re:Post
Basic health reporting - AWS Elastic Beanstalk

answered a year ago

EXPERT

reviewed a year ago

0

Adding in .ebextensions fixed the issue

Resources:
AWSEBAutoScalingGroup:
Type: "AWS::AutoScaling::AutoScalingGroup"
Properties:
HealthCheckType: ELB
HealthCheckGracePeriod: 300

Thanks

answered a year ago

0

Elastic Beanstalk only replaces instances when the environment’s Auto Scaling group health check type is set to ELB and the load balancer it references reports the instance as unhealthy. Since you attached a manually created ALB and target group, Elastic Beanstalk no longer manages those health checks or propagates them back into its environment health logic. The “Degraded” state you see in the console confirms that the EB health monitor sees the app failing but cannot trigger scaling actions because the ASG isn’t linked to an EB‑managed target group. —Taz

answered a year ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.