turbot/aws_insights

Query: vpc_gateways_for_vpc

Usage

powerpipe query aws_insights.query.vpc_gateways_for_vpc

SQL

select
internet_gateway_id as "ID",
tags ->> 'Name' as "Name",
'aws_vpc_internet_gateway' as "Type",
a ->> 'State' as "State"
from
aws_vpc_internet_gateway,
jsonb_array_elements(attachments) as a
where
a ->> 'VpcId' = reverse(split_part(reverse($1), '/', 1))
union all
select
id as "ID",
tags ->> 'Name' as "Name",
'aws_vpc_egress_only_internet_gateway' as "Type",
a ->> 'State' as "State"
from
aws_vpc_egress_only_internet_gateway,
jsonb_array_elements(attachments) as a
where
a ->> 'VpcId' = reverse(split_part(reverse($1), '/', 1))
union all
select
vpn_gateway_id as "ID",
tags ->> 'Name' as "Name",
'aws_vpc_vpn_gateway' as "Type",
a ->> 'State' as "State"
from
aws_vpc_vpn_gateway,
jsonb_array_elements(vpc_attachments) as a
where
a ->> 'VpcId' = reverse(split_part(reverse($1), '/', 1))
union all
select
nat_gateway_id as "ID",
tags ->> 'Name' as "Name",
'aws_vpc_nat_gateway' as "Type",
state as "State"
from
aws_vpc_nat_gateway
where
vpc_id = $1

Dashboards

The query is used in the dashboards: