Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save jharrington22/91a13d0a827540ea04cd32d58b7d8d4b to your computer and use it in GitHub Desktop.
Save jharrington22/91a13d0a827540ea04cd32d58b7d8d4b to your computer and use it in GitHub Desktop.
Create bucket and ACL in all regions
#!/bin/bash
REGIONS=$( aws ec2 describe-regions --region us-east-1 | jq -r '.Regions[] | select(.OptInStatus=="opt-in-not-required").RegionName' )
for region in ${REGIONS[*]}
do
echo $region
BUCKET_NAME="test-bucket-acl-$RANDOM"
echo "Bucket name: $BUCKET_NAME region: $region"
aws s3api create-bucket --bucket "test-acl-bucket-$RANDOM" --region "$region" --acl private --create-bucket-configuration LocationConstraint="$region"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment