0

I have couple of instances part of ASG, these are worker ec2 instances not exposed to the public, there is a systemctl service initialized via user-data, sometimes initializing the service fails for a reason or another.

When such case happens I need a way to set the instance is unhealthy so that the ASG replaces it.

I thought if having cronjob running inside the ec2 instance or lambda function and trigger update-health-check but I think this is anti-pattern.

The custom up/down 0/1 cloudwatch matrix and an alarm based on the value to set it as healthy could be the solution, is there is any out of the box design to solve this trivial workflow?

Aladdin
  • 101
  • What kind of health check is the autoscaling group using to determine if the instance is health? One way to solve this is to make sure the health check returns unhealthy, which might mean a bit of scripting. A custom script can do any checking required, return (something like) http 400 (ok) status code if it works, otherwise return a 5xx code. It should log a message to Cloudwatch logs so you know what the problem was and can fix it. – Tim Nov 17 '22 at 18:07

0 Answers0