turbot/aws_insights

Query: vpc_eips_for_redshift_cluster

Usage

powerpipe query aws_insights.query.vpc_eips_for_redshift_cluster

SQL

with redshift_clusters as (
select
arn,
elastic_ip_status,
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
), vpc_eip as (
select
arn,
public_ip,
region,
account_id
from
aws_vpc_eip
where
account_id = split_part($1, ':', 5)
and region = split_part($1, ':', 4)
)
select
e.arn as eip_arn
from
redshift_clusters as c,
vpc_eip as e
where
c.elastic_ip_status is not null
and e.public_ip = (c.elastic_ip_status ->> 'ElasticIp')::inet;