turbot/aws_tags

Control: EC2 instances should not exceed tag limit

Description

Check if the number of tags on EC2 instances do not exceed the limit.

Usage

Run the control in your terminal:

powerpipe control run aws_tags.control.ec2_instance_tag_limit

Snapshot and share results via Turbot Pipes:

powerpipe login
powerpipe control run aws_tags.control.ec2_instance_tag_limit --share

Steampipe Tables

Params

ArgsNameDefaultDescriptionVariable
$1tag_limit
45

SQL

with analysis as (
select
arn,
title,
cardinality(array(select jsonb_object_keys(tags))) as num_tag_keys,
region,
account_id,
tags,
_ctx
from
aws_ec2_instance
)
select
arn as resource,
case
when num_tag_keys > $1::integer then 'alarm'
else 'ok'
end as status,
title || ' has ' || num_tag_keys || ' tag(s).' as reason
, region, account_id
from
analysis;