0
votes

Taking a look at the GCE instances, you can see that there are two main types for IP Addresses(internal one and external one).

Now if I have a Google App Engine Application(flex env) and a backend which runs in a Google Compute Engine Instance. Both applications run in the same GCP project. Is it possible for the app engine application to request the GCE backend app using its internal ip address? I would guess that, apps which run within the same project are running within the same VPC.

Since I am using the GAE flex env, I can ssh the GAE instance, and with a curl request to the internal ip address of the GCE instance I get a response back, however when I try to request the GCE backend within the application(axios request for example) it doesn't work and I get no data and I can see in the GCE instance that the request was not forwarded to the server.

Any idea how I can use the internal ip address of the GCE instance to communicate with a GAE application which run in the same project?

2

2 Answers

0
votes

You can communicate via internal IP by launching your GAE Flex instances into the same network/subnetwork as your GCE instances. This is done by setting the network: section in your app.yaml file. See this documentation on network settings for more information.

0
votes

Alright so just to answer my own question, after a lot of tries and searching, the best way to communicate with the internal services was by creating an internal loadbalancer(tcp), because it makes no sense(for my use case at least) to connect to one instance, I wanted my application to scale after all. So what I did, I created a TCP Loadbalancer in front of the internal instances(they were running as an instance group anyway) after that I got a static internal ip and assigned it to the internal loadbalancer the used that static ip in GAE and it worked.

I made sure of the firewall rules were correct based on the instance group template. Eventually all worked.