Last active
September 22, 2021 04:42
-
-
Save pataiji/ddd2d3f5c351c1a81abcd10443f1e520 to your computer and use it in GitHub Desktop.
Restrict public access to all S3 buckets.
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
#!/bin/bash | |
aws s3api list-buckets | \ | |
jq '.Buckets[].Name' -r | \ | |
AWS_PAGER="" xargs -IXXX aws s3api put-public-access-block \ | |
--bucket XXX \ | |
--public-access-block-configuration BlockPublicAcls=true,IgnorePublicAcls=true,BlockPublicPolicy=true,RestrictPublicBuckets=true |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment