turbot/aws_insights

Query: dynamodb_table_autoscaling_status

Usage

powerpipe query aws_insights.query.dynamodb_table_autoscaling_status

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
),
table_autoscaling_status as (
select
d.name as table_name,
case
when t.resource_id is null or t.count < 2 then 'disabled'
else 'enabled'
end as autoscaling_status
from
aws_dynamodb_table as d
left join table_with_autoscaling as t on concat('table/', d.name) = t.resource_id
)
select
autoscaling_status,
count(*) as table_count
from
table_autoscaling_status
group by autoscaling_status;

Dashboards

The query is used in the dashboards: