Use DescribePrefixLists with an AWS SDK or CLI - AWS SDK Code Examples

There are more AWS SDK examples available in the AWS Doc SDK Examples GitHub repo.

Use DescribePrefixLists with an AWS SDK or CLI

The following code examples show how to use DescribePrefixLists.

CLI
AWS CLI

To describe prefix lists

This example lists all available prefix lists for the region.

Command:

aws ec2 describe-prefix-lists

Output:

{ "PrefixLists": [ { "PrefixListName": "com.amazonaws.us-east-1.s3", "Cidrs": [ "54.231.0.0/17" ], "PrefixListId": "pl-63a5400a" } ] }
PowerShell
Tools for PowerShell

Example 1: This example fetches the available AWS services in a prefix list format for the region

Get-EC2PrefixList

Output:

Cidrs PrefixListId PrefixListName ----- ------------ -------------- {52.94.5.0/24, 52.119.240.0/21, 52.94.24.0/23} pl-6fa54006 com.amazonaws.eu-west-1.dynamodb {52.218.0.0/17, 54.231.128.0/19} pl-6da54004 com.amazonaws.eu-west-1.s3