turbot/aws_insights

Query: vpc_by_rfc1918_range

Usage

powerpipe query aws_insights.query.vpc_by_rfc1918_range

Steampipe Tables

SQL

with cidr_buckets as (
select
vpc_id,
title,
b ->> 'CidrBlock' as cidr,
case
when (b ->> 'CidrBlock') :: cidr << = '10.0.0.0/8' :: cidr then '10.0.0.0/8'
when (b ->> 'CidrBlock') :: cidr << = '172.16.0.0/12' :: cidr then '172.16.0.0/12'
when (b ->> 'CidrBlock') :: cidr << = '192.168.0.0/16' :: cidr then '192.168.0.0/16'
else 'Public Range'
end as rfc1918_bucket
from
aws_vpc,
jsonb_array_elements(cidr_block_association_set) as b
)
select
rfc1918_bucket,
count(*)
from
cidr_buckets
group by
rfc1918_bucket
order by
rfc1918_bucket

Dashboards

The query is used in the dashboards: