turbot/alicloud_insights

Query: ecs_images_for_ecs_instance

Usage

powerpipe query alicloud_insights.query.ecs_images_for_ecs_instance

SQL

with instances as (
select
region,
account_id
from
alicloud_ecs_instance
where
arn = $1
and account_id = split_part($1, ':', 5)
and region = split_part($1, ':', 4)
)select
im.arn as image_arn
from
alicloud_ecs_instance as ins
join alicloud_ecs_image as im
on im.image_id = ins.image_id
and im.region = (select region from instances)
and im.account_id = (select account_id from instances)
where
ins.arn = $1
and ins.account_id = split_part($1, ':', 5)
and ins.region = split_part($1, ':', 4);