Log in to the AWS Management Console.
Navigate to EC2 dashboard at console.aws.amazon.com/ec2/.
In the navigation panel, under Elastic Block Store, click Volumes.
To identify any unattached EBS volumes, check their status under State column:
If the status is in-use, the volume is currently attached and cannot be deleted. If the status is available, the volume is not attached to an EC2 instance and can be safely deleted.
There are a number of ways to do this but the most straight forward way would be to use AWS SDK to check for the above condition and deploy the code in Lambda or EC2.
I work for TotalCloud, we help in automating without deploying any infra. Just write the logic using interactive UI or in this case use the template and get started in under 2 minutes.
We're a place where coders share, stay up-to-date and grow their careers.
We strive for transparency and don't collect excess data.