Skip to content

Instantly share code, notes, and snippets.

@dblooman
Created March 6, 2016 18:27
Show Gist options
  • Save dblooman/d5d6db2c410488524701 to your computer and use it in GitHub Desktop.
Save dblooman/d5d6db2c410488524701 to your computer and use it in GitHub Desktop.
require 'json'
response = `aws ec2 describe-volumes --region eu-west-1`
json = JSON.parse response
json["Volumes"].each do |vol|
if vol["State"] == "available"
`aws ec2 delete-volume --volume-id #{vol["VolumeId"]} --region eu-west-1`
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment