Integrate with Cloud databases
You can write functions that integrate with Cloud databases by importing the appropriate 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 Cloud database using Cloud Run.
Connect to Cloud SQL
Learn how to add database functionality to your Cloud Run with Cloud SQL:
- For connecting to a MySQL instance from a service running in Cloud Run, see Connect from Cloud Run.
- For connecting to a PostgreSQL instance from a service running in Cloud Run, see Connect from Cloud Run.
- For connecting to a SQL Server instance from a service running in Cloud Run, see Connect from Cloud Run.
Connect to Cloud BigQuery
Learn how to write an HTTP Cloud Run function that submits a query to BigQuery.
For details, see Create a function that returns BigQuery results in the Cloud Run documentation.
Connect to Memorystore for Redis
Learn about how to connect your Cloud Run functions to a Memorystore for Redis in-memory database.
For details, see Connecting to a Redis instance from Cloud Run functions in the Memorystore documentation.
User Spanner with Cloud Run functions
Learn about how to write, deploy, and trigger an HTTP Cloud Function that accesses Spanner.
For details, see Use Spanner with Cloud Run functions