turbot/gcp_thrifty

GitHub
Loading controls...

Control: Long running instances should be reviewed

Description

Instances should ideally be ephemeral and rehydrated frequently, check why these instances have been running for so long.

Usage

Run the control in your terminal:

steampipe check gcp_thrifty.control.compute_instance_long_running

Snapshot and share results via Steampipe Cloud:

steampipe login
steampipe check --share gcp_thrifty.control.compute_instance_long_running

Plugins & Tables

Params

ArgsNameDefaultDescriptionVariable
$1compute_running_instance_age_max_days
90
The maximum number of days instances are allowed to run.

SQL

select
self_link as resource,
case
when date_part('day', now() - creation_timestamp) > $1 then 'info'
else 'ok'
end as status,
title || ' has been running for ' || date_part('day', now() - creation_timestamp) || ' day(s).' as reason,
location,
project
from
gcp_compute_instance
where
status in ('PROVISIONING', 'STAGING', 'RUNNING', 'REPAIRING');

Tags