Skip to content

Instantly share code, notes, and snippets.

@jorke
Created November 4, 2015 06:22
Show Gist options
  • Save jorke/f1bf871760028a7c1caa to your computer and use it in GitHub Desktop.
Save jorke/f1bf871760028a7c1caa to your computer and use it in GitHub Desktop.
delete ec2 resources
#!/bin/bash
for s in $(aws ec2 describe-snapshots --owner-id self --output text | egrep SNAPSHOTS | cut -f6 -d$'\t'); do aws ec2 delete-snapshot --snapshot-id $s; done;
for i in $(aws ec2 describe-images --owners self --output text | egrep IMAGES | cut -f6 -d$'\t'); do aws ec2 deregister-image --image-id $i; done;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment