turbot/aws_insights

Query: vpc_vpcs_for_rds_db_cluster

Usage

powerpipe query aws_insights.query.vpc_vpcs_for_rds_db_cluster

SQL

select
distinct avs.vpc_id as vpc_id
from
aws_rds_db_cluster as rdc
join aws_rds_db_subnet_group as rdsg on rdc.db_subnet_group = rdsg.name
and rdc.region = rdsg.region
and rdc.account_id = rdsg.account_id
cross join jsonb_array_elements(rdsg.subnets) as vs
join aws_vpc_subnet as avs on avs.subnet_id = vs ->> 'SubnetIdentifier'
and avs.account_id = rdsg.account_id
and avs.region = rdsg.region
where
rdc.arn = $1;