turbot/aws_insights

Query: ec2_amis_for_ebs_volume

Usage

powerpipe query aws_insights.query.ec2_amis_for_ebs_volume

SQL

select
a.image_id as image_id
from
aws_ebs_volume as v,
aws_ebs_snapshot as s,
aws_ec2_ami as a,
jsonb_array_elements(block_device_mappings) as s_id
where
v.snapshot_id = s.snapshot_id
and s_id -> 'Ebs'->> 'SnapshotId' = s.snapshot_id
and v.arn = $1
and v.account_id = split_part($1, ':', 5)
and v.region = split_part($1, ':', 4);