TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Show HN: Which-cloud, what cloud does an ip address belong to?

38 pointsby BenjaminCoealmost 9 years ago

3 comments

ereyes01almost 9 years ago
This code seems to rely on IP ranges and whois lookups, which won&#x27;t work if you&#x27;re running on a network &#x2F; VPC that has no internet access<p>Some clouds provide a metadata api accessible via a link-local address. These are accessibly regardless of what network your instance is in.<p>AWS Metadata API: <a href="http:&#x2F;&#x2F;docs.aws.amazon.com&#x2F;AWSEC2&#x2F;latest&#x2F;UserGuide&#x2F;ec2-instance-metadata.html" rel="nofollow">http:&#x2F;&#x2F;docs.aws.amazon.com&#x2F;AWSEC2&#x2F;latest&#x2F;UserGuide&#x2F;ec2-insta...</a><p>GCE Metadata API: <a href="https:&#x2F;&#x2F;cloud.google.com&#x2F;compute&#x2F;docs&#x2F;metadata" rel="nofollow">https:&#x2F;&#x2F;cloud.google.com&#x2F;compute&#x2F;docs&#x2F;metadata</a><p>Azure Metadata API: <a href="https:&#x2F;&#x2F;azure.microsoft.com&#x2F;en-us&#x2F;blog&#x2F;what-just-happened-to-my-vm-in-vm-metadata-service&#x2F;" rel="nofollow">https:&#x2F;&#x2F;azure.microsoft.com&#x2F;en-us&#x2F;blog&#x2F;what-just-happened-to...</a><p>This library only appears to support detecting AWS&#x2F;GCE&#x2F;Azure, so perhaps trying URLs in each metadata API with no &#x2F; 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.<p>The downside of this approach is that maybe some clouds&#x2F;VPS&#x27;s don&#x27;t have metadata APIs accessible in this manner. Maybe this doesn&#x27;t work for some more obscure services, if you want to be super comprehensive.
评论 #11838715 未加载
pyvpxalmost 9 years ago
what does this add instead of using whois?
评论 #11838058 未加载
ers35almost 9 years ago
See also: The Hurricane Electric BGP Toolkit shows the ISP based on the AS number from which the IP address is announced: <a href="http:&#x2F;&#x2F;bgp.he.net&#x2F;" rel="nofollow">http:&#x2F;&#x2F;bgp.he.net&#x2F;</a><p>Example: <a href="http:&#x2F;&#x2F;bgp.he.net&#x2F;ip&#x2F;104.196.27.39" rel="nofollow">http:&#x2F;&#x2F;bgp.he.net&#x2F;ip&#x2F;104.196.27.39</a>