Simple App to fetch IP Address

Michał Świerczewski
2 min readApr 1, 2022

Fetch public IP Address from external sources with Golang and Azure.

I was looking for simple solution to fetch my IP from different locations when I connect to my App. Saying App I mean whatismyip application.

On daily bases I use Azure so I decided to use it to deploy my App there.
I didn’t use ACI or App Service for that because it causes troubles to fetch IP correctly. That’s why I decided to use Azure VM. Either I can run App on VM without any orchestration or use some, I choose docker. I also don’t want to expose VM directly, so I decided to use Azure Load Balancer with VM in backend.

To deploy LB + VM I have created dedicated repo with Terraform code. It’s here azure-vm-behind-lb . You can find there all details, step by step, first how to deploy all Azure resources and then on top whatismyip app. Once all is deployed, go to registered link and check your IP.

Remote Address is my external IP that I am using to connect
Just IP

That’s all. Simple, isn’t it?

--

--