Skip to content

Instantly share code, notes, and snippets.

@djmetzle
Created October 2, 2019 21:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save djmetzle/c46ac38a9357d2ee624e1a6c7dbce108 to your computer and use it in GitHub Desktop.
Save djmetzle/c46ac38a9357d2ee624e1a6c7dbce108 to your computer and use it in GitHub Desktop.
List which S3 buckets have logging enabled
#!/bin/bash -e
S3_BUCKETS=( `aws s3api list-buckets --query "Buckets[].Name" --output=text` )
for bucket in "${S3_BUCKETS[@]}"; do
BUCKET_LOGGING=`aws s3api get-bucket-logging --bucket $bucket`
if [ -n "$BUCKET_LOGGING" ]; then
echo "$bucket: $BUCKET_LOGGING"
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment