Finding Amazon S3 Region IP RangesI wanted to find the IP ranges for all of Amazon's US-based S3 regions. After a lot of searching through outdated forums, I found out how to get the ranges directly from the source. The Amazon Simple Storage Service (S3) is broken up into buckets that are stored in different regions. Currently, there are three US regions documented. I had to search for their actual hosts names which are documented in the AWS Java SDK.
whois. Host is a DNS lookup utility that resolves a host to an IP.
Now that I have the IP, I can run
$ host s3-us-west-1.amazonaws.com s3-us-west-1.amazonaws.com has address 126.96.36.199
whoison it to find its NetRange. Since
whoisalso returns a bunch of other information, I grepped for exactly what I wanted.
Now I have the IP range for the US West (Northern-California) S3 region. A note about the US Standard region: s3.amazonaws.com is actually aliased between s3-1.amazonaws.com and s3-2.amazonaws.com so I had to
$ whois 188.8.131.52 | grep NetRange NetRange: 184.108.40.206 - 220.127.116.11
whoisboth of those hosts.
$ host s3.amazonaws.com s3.amazonaws.com is an alias for s3.geo.amazonaws.com. s3.geo.amazonaws.com is an alias for s3-2.amazonaws.com. s3-2.amazonaws.com has address 18.104.22.168
Comments? Tweet or email me.