Skip to content

Instantly share code, notes, and snippets.

@djmetzle
Created May 1, 2018 22:24
Show Gist options
  • Save djmetzle/961ea8a966a5f2ac88aefb8ef13f49ce to your computer and use it in GitHub Desktop.
Save djmetzle/961ea8a966a5f2ac88aefb8ef13f49ce to your computer and use it in GitHub Desktop.
Quick Script to find S3 buckets with logging enabled
#!/bin/bash -e
# Get list of buckets
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