Created
October 16, 2016 03:11
-
-
Save BigAl/ff55965413f766fdce05b95cae82d490 to your computer and use it in GitHub Desktop.
AWS snapshots
This file contains hidden or 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
Get Our images | |
aws ec2 describe-images --region ap-southeast-2 --owners 627242648017 | grep SnapshotId | awk -F'[":]' '{print $5}' | sort | uniq > snaps_in_use_by_images | |
Get Our volumes | |
aws ec2 describe-volumes | awk -F'[":]' /snap-/'{print $5}' | sort | uniq > snaps_in_use_by_ec2_volumes | |
All Snapshot IDs | |
aws ec2 describe-snapshots --owner-ids 627242648017 | grep SnapshotId | awk -F'[":]' '{print $5}' | sort | uniq > all_snaps | |
cat snaps_in_use_by_ec2_volumes snaps_in_use_by_images |sort | uniq > all_snaps_in_use | |
comm -23 all_snaps all_snaps_in_use > snaps_not_inuse |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment