When teaching Learning Tree’s Cloud Computing Course, I demonstrate various aspects of Amazons Infrastructure as a Service (IaaS). As part of this, not only do I provision various machine types but also associated Elastic Block Storage (EBS) devices and attach and detach these. Since I use a demonstration account for this, one task I undertake at the end of the course is to make sure that all resources are released/removed so that no unnecessary costs are incurred. For the demonstrations, I always use the Amazon Web browser administration interface.
On a recent teach, I tidied up the account – or more accurately thought I had. When the monthly bill arrived, charges were still being incurred, albeit minor. The charges were for an EBS volume, which I thought would be straightforward to delete. However, when I tried to delete this from the browser administration interface, I received an error saying that the volume was in use and could not be deleted and should be detached using the force flag. This is a feature not available from the browser interface. Equally there was no other resource running on my account that the volume could be attached too ! I was paying for a fault in the browser interface and how resources had not been cleaned up properly by this toolset.
So what was the solution ? To detach the volume I used the EC2 command line tools. If you are not sure of these Kevin Kell has written a post on how to install these. The command to detach the volume is then simply:
$ ec2-detach-volume volume-id -force
The force flag is important here. Once this has completed the volume could be deleted using the command:
Hopefully you will not encounter this scenario, but if you do, you now know the solution.