What is AWS Prefix actually?

mon picture mon · Aug 2, 2018 · Viewed 8.5k times · Source

Question

What/where is the definition of AWS Prefix?

Background

While looking for a way to list S3 endpoint CIDR, encountered the word AWS prefix list but not sure what it exactly means and where the terminology is defined.

Confusion

Prefix means a word placed in front. For S3, according to Listing Keys Hierarchically Using a Prefix and Delimiter, it should be the starting path to an object.

However, apparently it refers to a IP address range. How come prefix is used for IP ranges? What is the history or reason?

Terraform aws_prefix_list

This can be used both to validate a prefix list given in a variable and to obtain the CIDR blocks (IP address ranges) for the associated AWS service.

describe-prefix-lists

Describes available AWS services in a prefix list format, which includes the prefix list name and prefix list ID of the service and the IP address range for the service.

AWS IP Address Ranges

SERVICE="S3"
REGION="us-west-1"
$ curl -s https://ip-ranges.amazonaws.com/ip-ranges.json | \
  jq -r --arg SERVICE "$SERVICE" --arg REGION "${REGION}" '.prefixes[] \
   | select(.service==$SERVICE and .region==$REGION)'

{
  "ip_prefix": "52.92.48.0/22",
  "region": "us-west-1",
  "service": "S3"
}
{
  "ip_prefix": "54.231.232.0/21",
  "region": "us-west-1",
  "service": "S3"
}
{
  "ip_prefix": "52.219.20.0/22",
  "region": "us-west-1",
  "service": "S3"
}
{
  "ip_prefix": "52.219.24.0/21",
  "region": "us-west-1",
  "service": "S3"
}

Update

Gateway VPC Endpoints

Specify the VPC in which to create the endpoint, and the service to which you're connecting. A service is identified by a prefix list—the name and ID of a service for a Region. A prefix list ID uses the form pl-xxxxxxx and a prefix list name uses the form "com.amazonaws.region.service". Use the prefix list name (service name) to create an endpoint.

what is the meaning of Prefix ?

suppose you have a network like 10.5.10.0/24 so you will have the 10.5.10 prefix in that subnet from 1 to 255 and your network address will be 10.5.10.0

I suppose (10.0.0.0/24) means (Top 24 bit part of 32 bit IP) of a network that has 254 ip addresses from 1 to 254 (0 is network and 255 is broadcast). Prefix is top 24 bit and suffix (?) is last 8 bit. List of top N bit which identifies a network is a list of IP prefix.

Answer

John Hanley picture John Hanley · Aug 2, 2018

The term prefix list comes from routing technology. An IP address in CIDR format has an IP prefix and a network prefix (10.1.0.0/16). The IP prefix is 10.1 and the network prefix is /16.

Therefore if you are using a list of IP addresses in CIDR format we call it an IP Prefix List.