turbot/alicloud_insights

Query: ecs_security_group_egress_rules

Usage

powerpipe query alicloud_insights.query.ecs_security_group_egress_rules

SQL

select
concat(
text(p ->> 'DestCidrIp'),
text(p ->> 'Ipv6DestCidrIp'),
text(p ->> 'DestGroupId'),
text(p ->> 'DestPrefixListId')
) as "Destination",
p ->> 'Policy' as "Policy",
case
when p ->> 'IpProtocol' = 'ALL' then 'All Traffic'
when p ->> 'IpProtocol' = 'ICMP' then 'ICMP'
else p ->> 'IpProtocol'
end as "Protocol",
case
when p ->> 'PortRange' = '-1/-1'
or p ->> 'PortRange' = '1/65535' then 'All'
when SPLIT_PART(p ->> 'PortRange', '/', 2) = SPLIT_PART(p ->> 'PortRange', '/', 1) then SPLIT_PART(p ->> 'PortRange', '/', 2) :: text
else p ->> 'PortRange'
end as "Ports"
from
alicloud_ecs_security_group,
jsonb_array_elements(permissions) as p
where
p ->> 'Direction' = 'egress'
and security_group_id = $1;

Dashboards

The query is used in the dashboards: