library
turbot/gcp_thrifty

Detect & correct AlloyDB instances exceeding max age

Overview

AlloyDB instances can be costly to run, especially if they're rarely used, instances exceeding a certain age should be reviewed to determine if they're still required.

This trigger detects AlloyDB instances exceeding a certain age 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

  • alloydb_instances_exceeding_max_age_trigger_enabled should be set to true as the default is false.
  • alloydb_instances_exceeding_max_age_trigger_schedule should be set to your desired running schedule
  • alloydb_instances_exceeding_max_age_default_action should be set to your desired action (i.e. "notify" for notifications or "delete_alloydb_instance" to delete the bucket).

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

select
concat(
instance_display_name,
' [',
location,
'/',
project,
']'
) as title,
instance_display_name as instance_name,
cluster_name,
_ctx ->> 'connection_name' as cred,
location,
project
from
gcp_alloydb_instance
where
date_part('day', now() - create_time) > 15;

Schedule

15m