turbot/aws_insights

Query: vpc_eips_for_ec2_instance

Usage

powerpipe query aws_insights.query.vpc_eips_for_ec2_instance

SQL

with aws_ec2_instances as (
select
instance_id,
account_id,
region
from
aws_ec2_instance
where
account_id = split_part($1, ':', 5)
and region = split_part($1, ':', 4)
and arn = $1
),
aws_vpc_eips as (
select
instance_id,
arn,
account_id,
region
from
aws_vpc_eip
where
account_id = split_part($1, ':', 5)
and region = split_part($1, ':', 4)
)
select
e.arn as eip_arn
from
aws_vpc_eips as e,
aws_ec2_instances as i
where
e.instance_id = i.instance_id;