Get IP of Heroku dynos

后端 未结 2 1789
佛祖请我去吃肉
佛祖请我去吃肉 2021-02-15 19:11

I have a Heroku app making some API calls to an external service. There are some issues and the service wants to know what IPs are making the calls.

A lot of the basic

2条回答
  •  深忆病人
    2021-02-15 19:30

    Get the list of dynos with the heroku ps -a command.

    You actually can ssh into individual dyno instances with heroku ps:exec -a -d --ssh.

    Get the individual dyno IP with the ip command e.g. ip addr | grep "global eth0" | awk '{ print $2 }'.

    Get the router IP with curl 'https://api.ipify.org'. http://httpbin.org/ip is also good.

    You could use expect to programmatically retrieve the IPs from every dyno by running the Heroku SSH command, waiting for the prompt, running the IP command(s), logging out, then repeating for each dyno instance.

提交回复
热议问题