SHARE
TWEET

Untitled

a guest Aug 22nd, 2019 67 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top