turbot/aws_insights

Query: dynamodb_table_autoscaling_state

Usage

powerpipe query aws_insights.query.dynamodb_table_autoscaling_state

SQL

with table_with_autoscaling as (
select
t.resource_id as resource_id,
count(t.resource_id) as count
from
aws_appautoscaling_target as t where service_namespace = 'dynamodb'
group by t.resource_id
)
select
case when t.resource_id is null or t.count < 2 then 'Disabled' else 'Enabled' end as value,
'Auto Scaling' as label,
case when t.resource_id is null or t.count < 2 then 'alert' else 'ok' end as type
from
aws_dynamodb_table as d
left join table_with_autoscaling as t on concat('table/', d.name) = t.resource_id
where
d.arn = $1
and d.region = split_part($1, ':', 4)
and d.account_id = split_part($1, ':', 5);

Dashboards

The query is used in the dashboards: