Skip to content

AWS elastic beanstalk auto scaling group - Health check grace period value reset after managed update

0

I have set the health check grace period to be 1200 in an auto scaling group. However when the elastic beanstalk managed update runs and updates the launch template to the latest version, the health check grace period is set back to 600. I can see a log of this in CloudTrail where elastic beanstalk creates an UpdateAutoScalingGroup event and passes in the new launch template version. It also passes in additional request parameters as follows

"requestParameters": { "autoScalingGroupName": "xxxxxx", "launchTemplate": { "launchTemplateId": "xxxxxx", "version": "31" }, "defaultCooldown": 360, "availabilityZones": [ "eu-west-1b", "eu-west-1c" ], "healthCheckType": "ELB", "healthCheckGracePeriod": 600, "maxInstanceLifetime": 0 }

Is there a way to stop this from resetting the health check grace period?

asked 2 years ago378 views
1 Answer
2
Accepted Answer

To prevent Elastic Beanstalk from resetting the health check grace period when it updates the launch template, you can use an Elastic Beanstalk configuration file (ebextension) to modify the AWSEBAutoScalingGroup resource.

Follow these steps:

  1. Create a new folder called .ebextensions in the root of your source bundle.

  2. Inside the .ebextensions folder, create a configuration file with the .config extension, e.g., autoscaling.config.

  3. In the autoscaling.config file, add the following configuration:

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

Replace 1200 with the desired health check grace period value in seconds.

  1. Include the .ebextensions folder when generating the deployment package for your Elastic Beanstalk application.

This configuration file will override the default health check grace period (600 seconds) set by Elastic Beanstalk when updating the launch template. The HealthCheckType property is set to ELB, which means the Auto Scaling group will use Elastic Load Balancing health checks to determine an instance's health, in addition to Amazon EC2 status checks.

By including this configuration file in your deployment package, Elastic Beanstalk will apply the specified health check grace period value whenever it updates the launch template, ensuring that your desired setting is not reset.

[+] https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/environmentconfig-autoscaling-healthchecktype.html

[+] https://repost.aws/questions/QUOoSA1ABoSK2bP-8F0Enkxg/modify-auto-scaling-health-check-setting-for-elastic-beanstalk-enviornment

AWS
EXPERT
answered a year ago
EXPERT
reviewed a year ago
  • Thank you. We already had an autoscaling.config setup within our solution that was updating the Health Check Grace period. This was set to 600 which was why the changes in the console were being overwritten.

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.