I have set the 'Application Healthcheck URL' (aws:elasticbeanstalk:application) for my elasticbeanstalk application, and during the night the two servers started failing this check.
It seems that the autoscaling group set up by elasticbeanstalk has a health check type of ec2 which means that the servers did not get terminated and replaced, leaving 2 out of service servers attached to the load balancer.
How can I change the autoscaling group's health check type to be elb using the elasticbeanstalk's configuration settings? I cannot find any documented way of changing this value, but it must be a fairly common requirement.
Thanks
Custom health detection tasks This extends your health checks by using a combination of custom health checks, Amazon EC2 status checks, and Elastic Load Balancing health checks, if enabled. You can send the instance health information directly to Amazon EC2 Auto Scaling using the AWS CLI or an SDK.
On the Amazon EC2 console navigation pane, under Instances, choose Instances, and then select the instance. Choose the Monitoring view and note the status of the instance. If the status is Insufficient Data, select the instance again, choose the Actions menu, choose Instance State, and then choose Terminate.
It turns out the answer lies in adding a config file to the .ebextensions directory.
The AWS documentation doesn't appear to be correct, or at least not up to date.
Here it tells you that you can configure EB resources using a config file: http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/environment-resources.html
But it doesn't tell you where to put that config file. To find that out you need to follow a link to: http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/customize-containers.html
The first link helpfully tells you the name of various resources you can configure. In my case I needed 'AWSEBAutoScalingGroup'. But then it doesn't tell you what the resource type identifier (Type) or the available properties are. It has a link to the 'resource type identifiers' (http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/aws-template-resource-type-ref-aeb.html), but there's no mention of autoscaling or elastic beanstalk there.
Luckily a kind soul on the AWS forums sent me a link to some helpful documentation: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-as-group.html
So finally I was able to create my config file which looks like this:
Resources: AWSEBAutoScalingGroup: Type: "AWS::AutoScaling::AutoScalingGroup" Properties: HealthCheckType: ELB HealthCheckGracePeriod: 600
This now works like a charm!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With