Created
October 1, 2020 17:58
-
-
Save jpate24/2fdbed3dbc25413bf62e0f28c5881a45 to your computer and use it in GitHub Desktop.
Shell code to delete available volumes on the AWS console
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
#for machine in $(aws ec2 describe-regions --output text | awk {'print $4'}) | |
#do | |
# echo $machine | |
#done | |
for volume in $(aws ec2 describe-volumes --region us-east-1 --output text | grep available | awk '{print $8}' | grep vol | tr '\n' ' ') | |
do | |
echo "deleting $volume" | |
aws ec2 delete-volume --volume-id $volume | |
echo "done deleting $volume" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment