turbot/digitalocean_thrifty

Control: Block storage volume snapshots created over 90 days ago should be deleted if not required

Description

Old snapshots are likely unneeded and costly to maintain.

Usage

Run the control in your terminal:

powerpipe control run digitalocean_thrifty.control.block_storage_volume_snapshot_age_90

Snapshot and share results via Turbot Pipes:

powerpipe login
powerpipe control run digitalocean_thrifty.control.block_storage_volume_snapshot_age_90 --share

Steampipe Tables

Params

ArgsNameDefaultDescriptionVariable
$1block_storage_volume_snapshot_age_max_days
90
The maximum number of days snapshots can be retained.

SQL

select
a.id as resource,
case
when a.created_at > (current_timestamp - ($1::int || ' days')::interval) then 'ok'
else 'alarm'
end as status,
a.title || ' has been created for ' || date_part('day', now() - a.created_at) || ' day(s).' as reason
, r.name as region
from
digitalocean_snapshot a,
jsonb_array_elements_text(regions) as region
left join digitalocean_region as r on r.slug = region
where
a.resource_type = 'volume';

Tags