Advertisement
Guest User

Untitled

a guest
Aug 22nd, 2019
117
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.57 KB | None | 0 0
  1. #!/usr/bin/env bash
  2.  
  3. public=0
  4.  
  5. for snapshot in $(aws ec2 describe-snapshots --owner-ids 089941056973 | jq -r ".Snapshots[].SnapshotId")
  6. do
  7. permissions=$(aws ec2 describe-snapshot-attribute --attribute createVolumePermission --snapshot-id ${snapshot} | jq -r ".CreateVolumePermissions")
  8. if [[ "${permissions}" = "[]" ]]; then
  9. echo "\033[32m${snapshot} is private"
  10. else
  11. echo "\033[31m${snapshot} is NOT private\!"
  12. ((public++))
  13. fi
  14. echo
  15. echo "\033[31m${public} snapshots are not completely private and should have their permissions verified.\033[0m"
  16. done
  17.  
  18. exit
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement