turbot/aws_insights

Query: ebs_snapshots_for_ec2_ami

Usage

powerpipe query aws_insights.query.ebs_snapshots_for_ec2_ami

SQL

select
s.snapshot_id as ebs_snapshot_id
from
aws_ebs_snapshot as s,
aws_ec2_ami as ami,
jsonb_array_elements(ami.block_device_mappings) as device_mappings
where
device_mappings -> 'Ebs' is not null
and s.snapshot_id = device_mappings -> 'Ebs' ->> 'SnapshotId'
and ami.image_id = $1