Unattached disks often result from incomplete resource deletion, failed deployments, or broken automation. They generate storage costs even when not in use and may contain sensitive data from previously terminated instances.
If you run a CloudQuery sync with AWS, GCP, and Azure, you can listing all unattached disks with this simple PostgreSQL query:
SELECT project_id AS account_id, name, tags
FROM gcp_compute_disks
WHERE length(users) = 0
UNION
SELECT subscription_id AS account_id, name, tags
FROM azure_compute_disks
WHERE managed_by IS NULL
UNION
SELECT account_id AS account_id, volume_id, tags
FROM aws_ec2_ebs_volumes
WHERE attachments = '[]';