turbot/gcp_thrifty

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:

powerpipe control run gcp_thrifty.control.compute_instance_long_running

Snapshot and share results via Turbot Pipes:

powerpipe login
powerpipe control run gcp_thrifty.control.compute_instance_long_running --share

Steampipe 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