Get IP address Of my Firebase Cloud Fucntion - firebase

I need to access some external API from my Firebase cloud function.
However, they need me to add my server IP to their IP Whitelist. Do I have the possibility to get the external IP address of a firebase cloud function?
P.S: an IP identification website give me 216.239.36.54 as the address. Is It right?

Cloud Functions are automatically provisioned and unprovisioned as requests are made to them, so they are not on a fixed IP address. If you wait 15 minutes, you might get a different IP address, and if you get many users they will be served from multiple different IP addresses.
The external API will need to allow access from the entire range of IP addresses that Cloud Functions may use. Alternatively, the documentation suggests that you can associate function egress traffic with a static IP address. Note that this last option seems non-trivial to me from a quick scan of the documentation.
Also see:
Possible to get static IP address for Google Cloud Functions?

Related

How to know the IP address of the default domain in Firebase Hosting

I'm currently using firebase hosting with my default domain.
Is there a way to check if the IP address associated with this domain is a static IP address?
thank you very much.
I looked up her IP on an IP address lookup service and it pointed to the same her IP address for several days.
I checked the firebase hosting reference, but there was no explanation about the default domain.
* https://firebase.google.com/docs/hosting
Edit: #pregum_fox (the OP) added in the comments below that when they contacted Firebase Support directly, the team confirmed that all *.web.app and *.firebaseapp.com domains will resolve to the same IP address - which at the time of writing is 199.36.158.100, a Fastly edge server. Custom domains will use a different edge server identified in the Firebase Console.
Original content:
If it's not documented, it likely isn't - or at least, is not guaranteed to be.
The only time an IP address linked with your Firebase Hosting site should not change (without being advised), is when you've connected it to a custom domain. This is because the IP address you register as the A record for your custom domain must remain the same to work properly. If it changed often, using a custom DNS would be pointless.

Is it possible to change project ip address in google cloud console or firebase console

Some of my projects in my firebase account are blocked by ip address in my country. I guess thats was happened, in case of blocking some google resources that uses same ip address. For now, i have website in my firebase account: oneday.tv. Its domain name has ping for: 199.36.158.100. I can access to it only through vpn. Some projects in same firebase account works ok, because they has different ip. In firebase support told me, that it's the reason of government decision. Can i change ip address for existing projects in my firebase console or google cloud console? Even if i tried to create brand new firebase project, its gets this ip address 199.36.158.100. May be there is a way to get another ip address for new project?
Unfortunately no. The reason you are getting the same IP address is that address is the Google Frontend's IP address. You cannot change that.
You would need to switch to a service that supports external IP addresses such as Compute Engine. However, you cannot select a specific address, just the one Google selects from an available address pool, so it is a coin toss if that address would be blocked.

Internal only HTTP Cloud Function unreachable

I am trying to set up a HTTP Cloud Function that allows only internal traffic, as explained in Google’s public docs.
However, when I try to access the function from a GCE instance that does not have an external IP address it does not work, and gives me the following error:
Image
As you can see in the following screenshots, I have both the Function and the GCE instance in the same region:
Functions
GCE network interface
This project only has 1 VPC network, which is the default one, and the source code for the Cloud Function is the default suggestion of the Console:
Source code
Strangely enough, if I give an external IP address to the GCE instance it works, so does it mean that the traffic is still going to the internet?
If a compute engine lacks an external IP, it can only send packets to other internal IP address destinations. You still have to connect to a set of external IP addresses used by Google APIs and services. This can be done by enabling Private Google Access on the subnet used by the VM/function
Documentation: https://cloud.google.com/vpc/docs/configure-private-google-access

Is it possible to access a Firebase hosting site via an IP address?

I have a hardcoded DDNS URL in an application that I can no longer modify the code for. It currently points to a server using its IP address and I'm trying to move over to Firebase.
My problem is that I need to update the DDNS URL with an IP address but I've only got a hosting URL like https://myapp-123q4.firebaseapp.com/.
My understanding is (from this Google Groups post) that because the entire system is shared, there are some specific IP addresses that can be used. Is there any way to access my own firebase hosting URL using an IP address?
(Pinging my firebase URL gave me the IP 151.101.1.195 which is one of the ones mentioned on the above linked post.)
You should not depend on direct IP addresses for accessing Firebase Hosting. There are simply not enough IPv4 addresses available for everyone to have exclusive access to one. You need to use the host name in the HTTP request so that the server can route the request to the correct content.

Will the IP address of the Google API host ever change?

We would like to use the Google Translate API from a host which doesn't have open access to the Internet. To setup the firewall rules I would need the list of possible IP addresses for www.googleapis.com. It is resolved to different IP addresses depending on the location. It seems to be difficult to create a future proof firewall rule.
Do you know how could I get the list of IP addresses or network ranges for the Google API servers?
The IP addresses used for any given googleapis.com server could change. Google doesn't have just one network block which they host all of their content out of, they have a bunch of them - and they change over time.
There are several ways you could setup your restricted network to allow access to *.googleapis.com without hard-coding IP addresses. I don't know anything about your setup, but I've found that using an internal proxy is often the best bet when you want to allow/restrict access to a domain.

Resources