turbot/steampipe-mod-aws-thrifty

Control: DynamoDB tables without auto-scaling should be reviewed

Description

DynamoDB tables with provisioned capacity mode should use auto-scaling to optimize costs. Auto-scaling automatically adjusts read and write capacity based on actual usage patterns, helping to avoid over-provisioning and reduce costs.

Usage

Run the control in your terminal:

powerpipe control run aws_thrifty.control.dynamodb_table_without_autoscaling

Snapshot and share results via Turbot Pipes:

powerpipe login
powerpipe control run aws_thrifty.control.dynamodb_table_without_autoscaling --share

Steampipe Tables

SQL

with dynamodb_autoscaling as (
select
split_part(resource_id, '/', 2) as table_name,
count(*) as scaling_configs
from
aws_appautoscaling_target
where
service_namespace = 'dynamodb'
group by
split_part(resource_id, '/', 2)
)
select
'arn:' || t.partition || ':dynamodb:' || t.region || ':' || t.account_id || ':table/' || t.name as resource,
case
when t.billing_mode = 'PAY_PER_REQUEST' then 'ok'
when coalesce(a.scaling_configs, 0) > 0 then 'ok'
else 'alarm'
end as status,
case
when t.billing_mode = 'PAY_PER_REQUEST' then t.name || ' uses on-demand capacity mode.'
when coalesce(a.scaling_configs, 0) > 0 then t.name || ' has auto-scaling configured.'
else t.name || ' uses provisioned capacity without auto-scaling.'
end as reason
, region, account_id
from
aws_dynamodb_table as t
left join dynamodb_autoscaling as a on t.name = a.table_name;

Tags