turbot/aws_insights

Query: ebs_volume_attached_instances

Usage

powerpipe query aws_insights.query.ebs_volume_attached_instances

SQL

select
i.instance_id as "Instance ID",
i.Tags ->> 'Name' as "Name",
i.arn as "Instance ARN",
i.instance_state as "Instance State",
attachment ->> 'AttachTime' as "Attachment Time",
(attachment ->> 'DeleteOnTermination')::boolean as "Delete on Termination"
from
aws_ebs_volume as v,
jsonb_array_elements(attachments) as attachment,
aws_ec2_instance as i
where
i.instance_id = attachment ->> 'InstanceId'
and v.arn = $1
and v.account_id = split_part($1, ':', 5)
and v.region = split_part($1, ':', 4)
order by
i.instance_id;

Dashboards

The query is used in the dashboards: