turbot/aws_insights

Query: redshift_clusters_for_sns_topic

Usage

powerpipe query aws_insights.query.redshift_clusters_for_sns_topic

SQL

with redshift_event_subscriptions as (
select
source_ids_list,
sns_topic_arn
from
aws_redshift_event_subscription
where
account_id = split_part($1, ':', 5)
and region = split_part($1, ':', 4)
)
select
c.arn as cluster_arn
from
redshift_event_subscriptions as s,
jsonb_array_elements_text(source_ids_list) as ids
join aws_redshift_cluster as c
on ids = c.cluster_identifier
where
s.sns_topic_arn = $1
and c.account_id = split_part($1, ':', 5)
and c.region = split_part($1, ':', 4);