If you are creating a new function, see the Console Quickstart on Cloud Run. The content on this page only applies to existing legacy functions created with the Cloud Functions v2 API.
Stay organized with collections
Save and categorize content based on your preferences.
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.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-04-17 UTC."],[[["Cloud Run functions can integrate with various Cloud databases by using the appropriate Cloud Client Libraries in the source code."],["You can connect to Cloud SQL instances, including MySQL, PostgreSQL, and SQL Server, from a service running in Cloud Run."],["Cloud Run functions can submit queries to Cloud BigQuery, as detailed in the \"Create a function that returns BigQuery results\" guide."],["Connecting Cloud Run functions to a Memorystore for Redis in-memory database is possible, with instructions available in the Memorystore documentation."],["You can use Cloud Run functions to interact with Spanner, and specific guidance is provided on writing, deploying, and triggering these functions."]]],[]]