turbot/azure_thrifty
Loading controls...

Control: Long running SQL databases should have reserved capacity purchased for them

Description

Purchasing reserved capacity for long running SQL databases provides significant discounts.

Usage

Run the control in your terminal:

powerpipe control run azure_thrifty.control.sql_database_long_running_reserved_capacity

Snapshot and share results via Turbot Pipes:

powerpipe login
powerpipe control run azure_thrifty.control.sql_database_long_running_reserved_capacity --share

Steampipe Tables

Params

ArgsNameDefaultDescriptionVariable
$1sql_database_age_max_days
90
The maximum number of days databases are allowed to run.
$2sql_database_age_warning_days
30
The number of days databases can be running before sending a warning.

SQL

select
db.id as resource,
case
when date_part('day', now() - creation_date) > $1 then 'alarm'
when date_part('day', now() - creation_date) > $2 then 'info'
else 'ok'
end as status,
db.title || ' has been in use for ' || date_part('day', now() - creation_date) || ' day(s).' as reason,
db.resource_group,
display_name as subscription
from
azure_sql_database as db,
azure_subscription as sub
where
db.name != 'master'
and db.subscription_id = sub.subscription_id;

Tags