Last active
September 13, 2016 10:26
-
-
Save JamesCalleja/7fe2cd026999c2e305f6bcc1b5da17c5 to your computer and use it in GitHub Desktop.
Delete-UnattachedVolumes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#delets all volumes not attached to a running instance | |
$volumes = Get-EC2Volume | |
for ($i = 0; $i -ne $volumes.Length; $i ++) {if ($volumes[$i].state -eq 'available') {Remove-EC2Volume -VolumeId $volumes[$i].volumeID -Force; write-host 'Deleting volume:' $volumes[$i].volumeID }} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment