Created
December 2, 2015 03:54
-
-
Save amosshapira/21022bd5481f4e31ca16 to your computer and use it in GitHub Desktop.
Fetch the S3 prefix list ID's for S3 in all AWS regions. These are can then be used as destinations in route tables
This file contains hidden or 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 | |
# Fetch the S3 prefix list ID's for S3 in all AWS regions. | |
# These are can then be used as destinations in route tables | |
aws ec2 describe-regions --query 'Regions[*].RegionName' | \ | |
jq -r '.[]' | \ | |
while read REGION | |
do | |
echo ==== $REGION ==== | |
aws ec2 describe-prefix-lists \ | |
--region $REGION \ | |
--filters Name=prefix-list-name,Values=com.amazonaws.$REGION.s3 \ | |
--query 'PrefixLists[0].PrefixListId' | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Need to wrap https://gist.github.com/amosshapira/21022bd5481f4e31ca16#file-get-all-s3-prefix-lists-L10 in double-quotes, else
Thanks!