Control: Long running compute 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 oci_thrifty.control.compute_instance_long_running
Snapshot and share results via Turbot Pipes:
powerpipe loginpowerpipe control run oci_thrifty.control.compute_instance_long_running --share
Steampipe Tables
SQL
select a.id as resource, case when a.lifecycle_state <> 'RUNNING' then 'skip' when date_part('day', now() - a.time_created) > $1 then 'alarm' else 'ok' end as status, case when a.lifecycle_state <> 'RUNNING' then a.title || ' in ' || a.lifecycle_state || ' state.' else a.title || ' has been running ' || date_part('day', now() - a.time_created) || ' days.' end as reason, coalesce(c.name, 'root') as compartment , a.regionfrom oci_core_instance as a left join oci_identity_compartment as c on c.id = a.compartment_id;
Params
Args | Name | Default | Description | Variable |
---|---|---|---|---|
$1 | compute_running_instance_age_max_days |
| The maximum number of days instances are allowed to run. |