Addressing Cloud Run instances

Hello,
we have a webapp deployed on Cloud Run. Upon startup the webapp loads the application configuration parameters from a file.
After the initial load the configuration of the webapp is cached in memory for each running instance.
If the configuration is updated, then we need to sent a http request to each running instance in order to force them reloading the updated configuration.
In App Engine Flex, we can call a specific instance using its instanceID.
Is there a way to call a specific instance in a Cloud Run environment?Many thanks,
Fabio

2 2 130
2 REPLIES 2

Hello @fabiofor,

Welcome to Google Cloud Community!

Due to its managed nature and the level of infrastructure abstraction it provides, Google Cloud Run does not support addressing a specific instance directly through HTTP requests. You can learn more about this in the official documentation here.

This topic is also discussed on ServerFault, where a community member mentioned that Cloud Run is abstracted and managed on your behalf, eliminating the need to concern yourself with the underlying infrastructure. 

However, an alternative approach to achieving your goal of updating configurations across all running instances is to use Cloud Pub/Sub. This method ensures that all instances receive the update notification and can refresh their cache accordingly. For more information, please refer to our official documentation.

Additionally, you can explore how to maximize automation efficiency by leveraging GCP Cloud Functions with Google Cloud Storage Triggers and GCP Pub/Sub in this blog post: Leveraging GCP Cloud Functions with Google Cloud Storage Triggers and GCP Pub/Sub.

Hello, many thanks for your answer, it looks like the way to go.
Unfortunately, only one instance seems to receive the Pub/Sub message. Is there an option to force all the instances to receive the message?
Fabio