I’ve spent a lot of my life building networks and doing crazy things with networking stuff. As I’ve aged and matured–please, don’t giggle–I sometimes get confused as to what Internet Protocol (IP) address the world actually identifies me with. This is especially true with Amazon Web Services (AWS), which has accomplished far more insanity than I could ever dream of–cloud networking gets messy fast.
In this quick blog post, I’m going to tell you a little bit about the issue some of our Hurricane Labs’ administrators were experiencing with AWS, along with the neat tool I discovered to resolve this problem.
Quick AWS troubleshooting story
When we were troubleshooting a problem in AWS recently, some of our admins thought we should be seeing things–servers in this case, but it could be anything with an IP address–as one IP address, and others who thought the IP would be something different.
We were running a headless server, so using a web browser and going to WhatIsMyIP.com was out of the question (seriously, just go there and look at their source it’s… a LOT). So, I started thinking, ‘Wow, there should just be a simple API response to this.’ And after further consideration, I figured, ‘Hey, I’ll just write one!’
Then, I Googled. Turns out someone must’ve had the same problem as me and already wrote a thing for it.
Enter: ipify API
ipify API is a solution that does exactly what I described above. If you’re going to utilize it, you can use a web browser; however, if you don’t have one–like we didn’t–you can use curl and it will return only your public IP.
Step 1: Just ask for the IP, no funny business
Step 2: Make it fancy with a JSON response
One thing I noticed while working with it, is that you aren’t sent a newline, but it’s still much easier than writing my own. It’s also completely open source, so I can fix it myself if I so choose.
This process is great for more complex environments, especially when you’re attempting something like adding access control to a cloud service, and you can’t figure out which IP the service is seeing.
ipify API is a simple, unbiased tool that does exactly as it says–a quality that’s rare to find these days. Enjoy.
P.S. Check us out on Twitter at @hurricanelabs if you want to keep up with our latest in-house created blog posts and tutorials. Oh, and if you've lost your mind and decide you want to follow me, you can find me at @billford.