library
turbot/aws_thrifty

Detect & correct Route53 health checks if unused

Overview

Route53 health checks have an associated monthly cost, therefore those which are no longer required should be removed to prevent further charges.

This query trigger detects unused health checks and then either sends a notification or attempts to perform a predefined corrective action.

Getting Started

By default, this trigger is disabled, however it can be configured by setting the below variables

  • route53_health_checks_if_unused_trigger_enabled should be set to true as the default is false.
  • route53_health_checks_if_unused_trigger_schedule should be set to your desired running schedule
  • route53_health_checks_if_unused_default_action should be set to your desired action (i.e. "notify" for notifications or "delete_health_check" to delete the health check).

Then starting the server:

flowpipe server

or if you've set the variables in a .fpvars file:

flowpipe server --var-file=/path/to/your.fpvars

Query

with health_check as (
select
r.health_check_id as health_check_id
from
aws_route53_zone as z,
aws_route53_record as r
where
r.zone_id = z.id
)
select
concat(h.id, ' [', h.region, '/', h.account_id, ']') as title,
h.id,
h.region,
h._ctx ->> 'connection_name' as cred
from
aws_route53_health_check as h
left join health_check as c on h.id = c.health_check_id
where
c.health_check_id is null

Schedule

15m