Skip to content

Instantly share code, notes, and snippets.

@justinclayton
Created December 14, 2013 00:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save justinclayton/7954071 to your computer and use it in GitHub Desktop.
Save justinclayton/7954071 to your computer and use it in GitHub Desktop.
The marriage of aws-cli and jq means things like this aren't hard anymore!
#!/bin/bash
aws ec2 describe-volumes \
| jq '.Volumes[] \
| select((.State == "available") and (.Size == 8)) \
| .VolumeId' \
| xargs -n 1 aws ec2 delete-volume --volume-id
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment