2 Answers
- Newest
- Most votes
- Most comments
1
Hello.
How about getting the prefix list ID with the shell script below?
By running the shell script below, you can check the S3 managed prefix list IDs that can be used in the regions enabled in your AWS account.
#!/bin/bash
REGIONS=($(aws ec2 describe-regions --query "Regions[].RegionName" --output text))
for REGION in "${REGIONS[@]}"; do
echo "Checking region: $REGION"
PREFIX_LIST_ID=$(aws ec2 describe-managed-prefix-lists --region $REGION --filters "Name=prefix-list-name,Values=com.amazonaws.$REGION.s3" --query 'PrefixLists[0].PrefixListId' --output text)
if [[ -n $PREFIX_LIST_ID ]]; then
echo "Prefix List ID for S3 in $REGION: $PREFIX_LIST_ID"
else
echo "No S3 prefix list found for $REGION"
fi
done
When you run it, you can check it as follows.
Checking region: ap-south-1
Prefix List ID for S3 in ap-south-1: pl-78a54011
Checking region: eu-north-1
Prefix List ID for S3 in eu-north-1: pl-c3aa4faa
Checking region: eu-west-3
Prefix List ID for S3 in eu-west-3: pl-23ad484a
Checking region: eu-west-2
Prefix List ID for S3 in eu-west-2: pl-7ca54015
Checking region: eu-south-2
Prefix List ID for S3 in eu-south-2: pl-64a5400d
Checking region: eu-west-1
Prefix List ID for S3 in eu-west-1: pl-6da54004
Checking region: ap-northeast-3
Prefix List ID for S3 in ap-northeast-3: pl-a4a540cd
Checking region: ap-northeast-2
Prefix List ID for S3 in ap-northeast-2: pl-78a54011
Checking region: ap-northeast-1
Prefix List ID for S3 in ap-northeast-1: pl-61a54008
Checking region: ca-central-1
Prefix List ID for S3 in ca-central-1: pl-7da54014
Checking region: sa-east-1
Prefix List ID for S3 in sa-east-1: pl-6aa54003
Checking region: ap-southeast-1
Prefix List ID for S3 in ap-southeast-1: pl-6fa54006
Checking region: ap-southeast-2
Prefix List ID for S3 in ap-southeast-2: pl-6ca54005
Checking region: eu-central-1
Prefix List ID for S3 in eu-central-1: pl-6ea54007
Checking region: ap-southeast-3
Prefix List ID for S3 in ap-southeast-3: pl-64a7420d
Checking region: ap-southeast-4
Prefix List ID for S3 in ap-southeast-4: pl-d0a84db9
Checking region: us-east-1
Prefix List ID for S3 in us-east-1: pl-63a5400a
Checking region: us-east-2
Prefix List ID for S3 in us-east-2: pl-7ba54012
Checking region: us-west-1
Prefix List ID for S3 in us-west-1: pl-6ba54002
Checking region: us-west-2
Prefix List ID for S3 in us-west-2: pl-68a54001
0
Found a better alternative. Used RIP helper to get the id.
const ripRegion = RIPHelper.getRegion(this.region);
const prefixLists = JSON.parse(ripRegion.getService('ec2-pls').getCustomProperties()['aws_managed_prefix_lists']);
const s3PrefixList = prefixLists[`com.amazonaws.${this.region}.${S3}`]
answered 2 years ago
Relevant content
asked 3 months ago
