turbot/aws_insights

Query: vpc_subnet_association

Usage

powerpipe query aws_insights.query.vpc_subnet_association

SQL

-- EC2 instances
select
title as "Title",
'aws_ec2_instance' as "Type",
arn as "ARN",
'/aws_insights.dashboard.ec2_instance_detail?input.instance_arn=' || arn as link
from
aws_ec2_instance
where
subnet_id = $1
-- Lambda functions
union all
select
title as "Title",
'aws_lambda_function' as "Type",
arn as "ARN",
'/aws_insights.dashboard.lambda_function_detail?input.lambda_arn=' || arn as link
from
aws_lambda_function,
jsonb_array_elements(vpc_subnet_ids) as s
where
trim((s::text ), '""') = $1
-- Sagemaker Notebook Instances
union all
select
title as "Title",
'aws_sagemaker_notebook_instance' as "Type",
arn as "ARN",
null as link
from
aws_sagemaker_notebook_instance
where
subnet_id = $1
-- RDS DB Instances
union all
select
title as "Title",
'aws_rds_db_instance' as "Type",
arn as "ARN",
'/aws_insights.dashboard.rds_db_instance_detail?input.db_instance_arn=' || arn as link
from
aws_rds_db_instance,
jsonb_array_elements(subnets) as s
where
s ->> 'SubnetIdentifier' = $1
-- Network ACLs
union all
select
title as "Title",
'aws_vpc_network_acl' as "Type",
network_acl_id as "ID",
null as link
from
aws_vpc_network_acl,
jsonb_array_elements(associations) as a
where
a ->> 'SubnetId' = $1
-- Route Tables
union all
select
title as "Title",
'aws_vpc_route_table' as "Type",
route_table_id as "ID",
null as link
from
aws_vpc_route_table,
jsonb_array_elements(associations) as a
where
a ->> 'SubnetId' = $1;

Dashboards

The query is used in the dashboards: