turbot/aws_insights

Query: vpc_subnets_for_redshift_cluster

Usage

powerpipe query aws_insights.query.vpc_subnets_for_redshift_cluster

SQL

with redshift_clusters as (
select
arn,
cluster_subnet_group_name,
region,
account_id
from
aws_redshift_cluster
where
account_id = split_part($1, ':', 5)
and region = split_part($1, ':', 4)
and arn = $1
order by
arn,
title,
region,
account_id
), redshift_subnet_group as (
select
cluster_subnet_group_name,
subnets,
region,
account_id
from
aws_redshift_subnet_group
where
account_id = split_part($1, ':', 5)
and region = split_part($1, ':', 4)
)
select
subnet ->> 'SubnetIdentifier' as subnet_id
from
redshift_subnet_group s
join redshift_clusters as c on c.cluster_subnet_group_name = s.cluster_subnet_group_name,
jsonb_array_elements(s.subnets) subnet