turbot/aws_insights

Query: ec2_instances_for_ec2_gateway_load_balancer

Usage

powerpipe query aws_insights.query.ec2_instances_for_ec2_gateway_load_balancer

SQL

select
instance.arn as instance_arn
from
aws_ec2_target_group tg,
aws_ec2_instance instance,
jsonb_array_elements(tg.target_health_descriptions) thd
where
instance.instance_id = thd -> 'Target' ->> 'Id'
and $1 in
(
select
jsonb_array_elements_text(tg.load_balancer_arns)
);