Jonathan Livni
Jonathan Livni

Reputation: 107072

Find heroku dyno ip

My Heroku app has a single dyno, and it accesses external resources such as database\cache\web-services\etc?

The dyno IP address is not static and may change, but not very often. When you perform maintenance of these resources, it's often useful to know which IP is associated to which client, even if it's ad-hoc. Therefore...

How can I ad-hoc know what IP address would the dyno access the resources from?

Upvotes: 5

Views: 3736

Answers (2)

brucek
brucek

Reputation: 726

It turns out a guy called Major Hayden has a great service called icanhazip.com.

You can get your IP programmatically using these commands:

# get IPv4 address
curl -4 icanhazip.com
162.242.244.97

# get IPv6 address
curl -6 icanhazip.com
2001:4802:7802:102:c69b:800f:ff20:4cc4

Upvotes: 1

Yuval Adam
Yuval Adam

Reputation: 165182

One of the things about using a platform like Heroku is that you have no guarantee whatsoever about dyno (or other container) IPs. You won't have any real clue as to which dyno has which IP, as far as you know they might all be using the same network adapter (thus having the same external IP). Sure you can try to wing it, or set static IPs if you must, but it sounds like a workaround for a flawed process.

Instead, I would opt for a proper monitoring system, where you can view these, and other, stats in real-time (i.e. service connections, usage and other goodies). This is out of scope for this question, but look into solutions such as a Statsd + Graphite stack.

Upvotes: 3

Related Questions