Get hands-on experience with 20+ free Google Cloud products and $300 in free credit for new customers.

Cloud run Communication between Microservices in the same container.

Hello community,

I have a question regarding internal communication between Cloud-Run microservices deployed. 

Let's say we have Cloud-Run service A and Cloud-Run service B, service A should call service B.

At this time, to achieve communication between the microservices, they are making themselves visible to each other through the external load balancer.

In this scenario, connecting the microservices through the VPC connector, I must use the microservice-to-microservice pointing when appropriate using the internal URL of each microservice that will be consumed.

The VPC connector is configured to allow all traffic through it.

What is the approach I have to follow in order to allow this communication?

 

Scenario 1:

Route all internal traffic through a VPC connector to keep it out of sight of the Internet.

aatehortua_0-1670599441674.png

Scenario 2:

Connect service to service through the internal URL of each microservice and configure IAM policies to secure consumption through authentication.

aatehortua_1-1670599441678.png

 

Please, if you need more details, let us know.

0 1 1,211
1 REPLY 1

Hi @aatehortua,

Welcome to Google Cloud Community!

To allow communication between Cloud Run microservices deployed in the same container, you can use the internal URL of each microservice. You can also use the VPC connector to route all internal traffic and keep it out of sight of the Internet. In this case, you would need to configure the VPC connector to allow all traffic through it.
 
You can also consider using IAM policies to secure the communication between the microservices through authentication. This can be done by granting the appropriate permissions to the service accounts that are used by the microservices.
 
It's also a good idea to verify that the network connectivity between the microservices is properly set up, and that the microservices have the necessary permissions to access each other.
 
In general, it's important to carefully consider the security and networking aspects when setting up communication between microservices in Cloud Run. You should also test and verify the communication between the microservices to ensure that it is working as expected.
 
Thank you