简体   繁体   中英

AWS autoscaling group health check type : ELB or EC2?

I am creating an internet-facing classic load balancer (CLB) with configurations as below

Connection Draining:Enabled, 300 seconds

health check configuration 
Ping Target 
TCP:22
Timeout 5 seconds
Interval    30 seconds
Unhealthy threshold 2
Healthy threshold   10

and attach this CLB with an auto scaling group (ASG) with below configurations

Desired: 2
Availability Zone(s) : us-east-1a, us-east-1c
Min:2
Subnet(s) : subnet-0ab1df27,subnet-5dc8af06
Max: 20
Health Check Type: ELB
Health Check Grace Period: 300
Default Cooldown:300

below are the scaling policy attached with ASG

increase-instance-policy

Execute policy when: aws-ec2-alarm-CPU-high-utilization
breaches the alarm threshold: CPUUtilization >= 70 for 2 consecutive periods of 300 seconds for the metric dimensionsAutoScalingGroupName = demo-auto-scaling-group
Take the action: Add 1 instances
And then wait 300 seconds before allowing another scaling activity

decrease-instance-policy

Execute policy when: aws-ec2-alarm-CPU-low-utilization
breaches the alarm threshold: CPUUtilization <= 30 for 2 consecutive periods of 300 seconds the metric dimensions = demo-auto-scaling-group
Take the action: Remove 1 instances
And then wait 300seconds before allowing another scaling activity

BUT with above configurations instances are keep creating and terminating simultaneously without any CPU utilization?

Here is the activity history tab of ASG

Description:DescriptionLaunching a new EC2 instance: i-0768deac4d37591eb Cause:CauseAt 2017-01-03T10:11:42Z an instance was started in response to a difference between desired and actual capacity, increasing the capacity from 1 to 2.

Description:DescriptionTerminating EC2 instance: i-0768deac4d37591eb Cause:CauseAt 2017-01-03T10:19:02Z an instance was taken out of service in response to a ELB system health check failure.

also on ELB page, instance tab list the instances but the status are always shown OutOfService with the info

"Instance has failed at least the UnhealthyThreshold number of health checks consecutively."


But if I change Health Check Type : from ELB to EC2 than everything works good; no multiple instances creations/termination

but Here in this article I read that ELB health check is better than EC2 as it check EC instance health underneath;

--

kindly suggest me what wrong I am doing here; may be some time issue? as I am creating 2 instances and default cooldown time is 300 second and and meanwhile alarm is being is alarmed or any other issue?

Thanks

The issue is in the configuration of your load balancer. Change it as follows:

Timeout 30 seconds
Interval 60 seconds
Unhealthy threshold 10
Healthy threshold 2

When using ELB health check, the Auto Scaling Group will rely on the ELB health check to determine if an instance is healthy or not. It looks like the ELB health check is failing, which causes the ASG to terminate the instance and launch a new one.

Are you sure the ELB health check is correctly configured? It looks you are checking port 22. The ELB will need to be able to access this port. Is your security group allowing this?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM