turbot/aws_insights

Query: rds_db_instances_for_sns_topic

Usage

powerpipe query aws_insights.query.rds_db_instances_for_sns_topic

SQL

with rds_event_subscriptions as (
select
source_ids_list,
sns_topic_arn
from
aws_rds_db_event_subscription
where
account_id = split_part($1, ':', 5)
and region = split_part($1, ':', 4)
)
select
i.arn as db_instance_arn
from
rds_event_subscriptions as s,
jsonb_array_elements_text(source_ids_list) as ids
join aws_rds_db_instance as i
on ids = i.db_instance_identifier
where
s.sns_topic_arn = $1
and i.account_id = split_part($1, ':', 5)
and i.region = split_part($1, ':', 4);