Skip to content

Instantly share code, notes, and snippets.

@jpate24
Created October 1, 2020 17:58
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jpate24/2fdbed3dbc25413bf62e0f28c5881a45 to your computer and use it in GitHub Desktop.
Save jpate24/2fdbed3dbc25413bf62e0f28c5881a45 to your computer and use it in GitHub Desktop.
Shell code to delete available volumes on the AWS console
#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