These are just bash and python scripts that I wrote to do AWS chores conveniently.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

25 lines
807 B

# List buckets, then enable block public access on all of them
# The AWS profile you want to run with
# The bucket policy you want. This blocks all kinds of public access.
AWS="aws" # for handy debugging, change this to AWS="echo aws"
export AWS_PAGER="" # otherwise it pauses after every command!
# fetch all the buckets
BUCKETLIST=$(aws --profile ${PROFILE} s3api list-buckets --query 'Buckets[].Name' --output text)
for bucketname in ${BUCKETLIST}
echo -n "${bucketname}: "
${AWS} --profile ${PROFILE} s3api put-public-access-block \
--bucket "${bucketname}" \
--public-access-block-configuration "${BPAPOLICY}"
echo "done"