Ask Your Question

Revision history [back]

The process for establishing a connection between GCP CloudRun and GCP Redis with auth_enabled set to true involves the following steps:

  1. Obtain the connection details of the Redis instance, including the host IP address or DNS name, port number, and password.

  2. Modify the CloudRun service definition to add environment variables for the Redis connection details. These environment variables will be used by the application to establish a connection to Redis with authentication enabled:

    • REDIS_HOST: the Redis instance host IP address or DNS name.
    • REDIS_PORT: the Redis instance port number.
    • REDIS_PASSWORD: the Redis instance password.
  3. Update the CloudRun IAM policy to grant the service account used by the CloudRun service access to the Redis instance. This can be done by assigning the "Cloud Memorystore Redis Viewer" or "Cloud Memorystore Redis Editor" role to the service account.

  4. Modify the application code to use the Redis connection details specified in the environment variables to establish a connection to Redis with authentication enabled.

  5. Deploy the modified CloudRun service to establish the connection to Redis.

Once the connection is established, the application can use Redis to store and retrieve data as needed.