Testing connection to Azure Blob Storage with Managed Identity while sipping on a classic mojito

Looking for a secure way to connect to Azure Blob Storage with your Web API, while hosting your application in Azure Cloud? Managed Identity is by far the easiest way to connect and ramp up your…

Smartphone

独家优惠奖金 100% 高达 1 BTC + 180 免费旋转




How to create a Firebase Cloud Function with static outbound IP

Most of you have already created server-less functions which generates dynamic IP address(es). Mostly all this happens at the backend and you don’t have to worry about it. Trouble begins when you need to have a static outbound IP address of your function. It is generally required as a safety measure (for whitelisting) when integrating with external APIs (like PayTM payout APIs, Msg91 APIs etc). So here in this article, we will see how to create a firebase cloud function that has a static outbound IP.

In simple terms, you will connect your cloud function to a VPC Connector. This VPC will somehow be configured to tell the cloud function to pass the traffic using the static outbound IP from the VPC.

Run this command in terminal to check the networks list

You should see an output like this

Output in terminal

Here you can check the name of your VPC network. Most of the times, it will be default.

Run the following code to create a new router

Here, replace :

Run the following command in terminal

In the command above, replace:

Run the following command

In the command above, replace:

This is needed to route the traffic originating from the VPC network using the static IP address you created in Step 3

Run the following commands to create the connector

Replace the following:

To verify wether your connector is ready or not, run the following command

Replace the following:

The output should contain the line state: READY.

Now we are all set. All we need to do now is create the required function and link it to the VPC Connector. I have attached a dummy function code below which prints the outbound IP address. Have a look.

Code Image created on codeimg.io

Voila! All done now. Now you can have the ease of having a static IP within the comfort of firebase cloud functions. Enjoy!

You should see something like this 👇

Some useful resources for further clarifications :

Add a comment

Related posts:

Food Service Businesses Doing Well in 2021

The COVID-19 pandemic wreaked havoc on the restaurant industry in general. Still, some businesses are coming out stronger than before. Whether because they found their niche with a new customer base…

Getting More Done Means Understanding the Habit Loop

If you had to make a list of all of the major pain points that product managers around the world deal with every day, efficiency would undoubtedly be right at the top. When a job pulls your attention…

MY DATA VISUALIZATION PROJECT

My data set is about the top hits songs on Spotify from 2000–2019. I found this dataset from Kaggle. I first had to type music into the search bar and narrow down my search to a music dataset with…