Integrate with Cloud databases

You can write functions that integrate with Cloud databases by importing theappropriate Cloud Client Libraries for your chosen database into your source code.To deploy and trigger the function, you can use either:

  • Cloud Run functions (Recommended)
  • The Cloud Functions gcloud CLI

This page provides more information for learning about connecting with a Clouddatabase using Cloud Run.

Connect to Cloud SQL

Learn how to add database functionality to your Cloud Run withCloud SQL:

Connect to Cloud BigQuery

Learn how to write an HTTP Cloud Run function that submits a query toBigQuery.

For details, seeCreate a Cloud Run function that returns BigQuery results.

Connect to Memorystore for Redis

Learn about how to connect your Cloud Run functions toa Memorystore for Redis in-memory database.

For details, seeConnecting to a Redis instance from Cloud Run functions in theMemorystore documentation.

User Spanner with Cloud Run functions

Learn about how to write, deploy, and trigger an HTTP Cloud Function thataccesses Spanner.

For details, seeCreate a Cloud Run function that returns Spanner results.

Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2025-12-15 UTC.