Not only you can query by service but also you can get notification of any changes to ip ranges by subscribing to SNS AmazonIpSpaceChanged. source
To get ec2 service ip ranges
>> curl -s | jq -r '.prefixes[] | select(.service=="EC2") | .ip_prefix'

To select services in us-east-1 and us-west-2. This type of filtering might come handy when a service provider who runs on AWS specifically mentions which regions they run their service on ie circleci

>> curl -s | jq -r '.prefixes[] | select(select(.region=="us-east-1" or .region=="us-east-2" or .region=="us-west-1") and .service=="EC2") | .ip_prefix'
>>> curl -s | jq -r '.prefixes[] | select(select(.region=="us-east-1" or .region=="us-east-2" or .region=="us-west-1" ) and .service=="EC2") | .ip_prefix+ " " +.region' ' us-east-1 us-east-1 us-east-1 us-west-1 us-west-1 us-east-1 us-east-1 us-west-1 us-east-1 us-east-1 us-east-1 us-east-1
. us-east-1

serkan haytac

AWS Certified Solutions Architect - Associate
AWS Certified Developer - Associate
AWS Certified SysOps Administrator - Associate
One liners