Created
August 21, 2017 13:01
-
-
Save JcBanks/c8e6bb07f649a70518c27055fa0adbad to your computer and use it in GitHub Desktop.
Bulk S3 bucket logging update
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
Objective update all s3 buckets to a single logging bucket | |
Variables: | |
Target Bucket: [AccountId].logs | |
Target Prefix: s3/ | |
Replace $TargetPrfix and $TargetBucket | |
for i in `aws s3api list-buckets --query "Buckets[].Name" --output text`;do aws s3api put-bucket-logging --bucket $i --bucket-logging-status '{"LoggingEnabled":{"TargetPrefix":"$TargetPrfix'$i'/","TargetBucket":"'$TargetBucket'"}}';done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment