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 loginpowerpipe control run digitalocean_thrifty.control.block_storage_volume_snapshot_age_90 --share
Steampipe Tables
Params
Args | Name | Default | Description | Variable |
---|---|---|---|---|
$1 | block_storage_volume_snapshot_age_max_days |
| 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 = regionwhere a.resource_type = 'volume';