by BenjaminCoe on 6/4/16, 4:43 PM with 9 comments
by ereyes01 on 6/4/16, 10:56 PM
Some clouds provide a metadata api accessible via a link-local address. These are accessibly regardless of what network your instance is in.
AWS Metadata API: http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-insta...
GCE Metadata API: https://cloud.google.com/compute/docs/metadata
Azure Metadata API: https://azure.microsoft.com/en-us/blog/what-just-happened-to...
This library only appears to support detecting AWS/GCE/Azure, so perhaps trying URLs in each metadata API with no / minimal timeout is a more robust way of accomplishing this instead of relying on whois, and could provide the same functionality as is currently supported in the library.
The downside of this approach is that maybe some clouds/VPS's don't have metadata APIs accessible in this manner. Maybe this doesn't work for some more obscure services, if you want to be super comprehensive.
by pyvpx on 6/4/16, 9:02 PM
by ers35 on 6/5/16, 3:36 AM
Example: http://bgp.he.net/ip/104.196.27.39