turbot/aws_insights

Query: ec2_instances_for_iam_role

Usage

powerpipe query aws_insights.query.ec2_instances_for_iam_role

SQL

select
i.arn as instance_arn
from
aws_ec2_instance as i,
aws_iam_role as r,
jsonb_array_elements_text(instance_profile_arns) as instance_profile
where
r.arn = $1
and r.account_id = split_part($1, ':', 5)
and instance_profile = i.iam_instance_profile_arn;