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