Recently, my AWS account was heavily billed because I didn't pay attention to my unused EBS Volume.
We have been trying to pay attention the the unused EBS Volume and delete them, but is there a way to automate it?
Because it is practically difficult to implement the whole procedure manually periodically.
Even if I get notified monthly, it would be of great help.
Any input shall be appreciated.
For further actions, you may consider blocking this person and/or reporting abuse
Top comments (2)
Manual Way:
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.
Automation Way:
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.
please refer this script
if you volume is not attached then the state should be available so with the below python script you should be able to delete them.
gist.github.com/akloya/06016cbff38...