0

I have a job that cleans out unused health checks. Some of them cant be deleted if they have a parent check resulting in the error:

Invalid parameter : Health check SOMEHEALTHCHECKID is still referenced from parent health check(s): SOMEHEALTHCHECKID-PARENT

How can I list the parents of a health check? I would like to be able to obtain the id of the parent check in a method that is more stable than parsing the error message string.

Alex Cohen
  • 5,596
  • 16
  • 54
  • 104

1 Answers1

0

My solution was to collect all the health checks in route53 and parse them for any that matched the CALCULATED config type:

check[:health_check_config][:type] == "CALCULATED"

Then after getting the Aws::Route53::Errors::InvalidInput error during health check deletion, I would search through my parent check collection to see if any parent check included the failed check in its child_health_checks array:

parent_checks = parents.select{|parent_check| 
  parent_check[:health_check_config][:child_health_checks].include?(check[:id])
}

I could then delete all the matching parent checks and retry the regular deletion after.

Alex Cohen
  • 5,596
  • 16
  • 54
  • 104