Integrate with Cloud databases Stay organized with collections Save and categorize content based on your preferences.
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:
- For connecting to a MySQL instance from a service running inCloud Run, seeConnect from Cloud Run.
- For connecting to a PostgreSQL instance from a service running inCloud Run, seeConnect from Cloud Run.
- For connecting to a SQL Server instance from a service running inCloud Run, seeConnect from Cloud Run.
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.