Created
May 28, 2019 15:33
-
-
Save mgeeky/dd653ef3ec3aa8805264fb6a31244a54 to your computer and use it in GitHub Desktop.
One-liner that dumps all of the S3 buckets from different regions and all their Bucket policies.
This file contains 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
P=aws-profile; for region in `aws ec2 describe-regions --output text | cut -f3`; do for bucket in `aws --region $region --profile $P s3api list-buckets --query 'Buckets[*].Name' --output text | tr '\t' '\n'`; do aws --profile $P --region $region s3api get-bucket-policy --bucket $bucket --query 'Policy' --output text 2> /dev/null | jq '.' | tee $P-$bucket.json ; done ; done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment