The Simplest Way to Make Cloud Run and Databricks Work Like They Should
Using cloud run and databricks together lets stateless web apps run large data jobs. Cloud Run handles user traffic while Databricks processes and stores big data tables. Teams build this setup to trigger data jobs or read clean tables on demand. A user clicks a button in a web app, and Cloud Run gets the request. Then the container sends a query or job call to the Databricks workspace. This keeps the web tier light and leaves heavy math to the data cluster. How cloud run and databricks handl
Your coding agents run with your access.
Claude Code reaches prod with a developer's credentials, and approval prompts get clicked through. hoop.dev checks every query, masks sensitive data, and holds risky changes for a human.
Using cloud run and databricks together lets stateless web apps run large data jobs. Cloud Run handles user traffic while Databricks processes and stores big data tables.
Teams build this setup to trigger data jobs or read clean tables on demand. A user clicks a button in a web app, and Cloud Run gets the request. Then the container sends a query or job call to the Databricks workspace. This keeps the web tier light and leaves heavy math to the data cluster.
How cloud run and databricks handle identity and data flow
Each Cloud Run service runs as a distinct cloud service account in your project. That identity needs a valid credential to log in to the Databricks API or warehouse. Most teams set up a service principal inside the Databricks account for this task. The Cloud Run app exchanges its cloud token or reads a stored secret to log in.
Once the app logs in, it sends queries over HTTPS to a SQL warehouse. It can also trigger a scheduled job through the standard REST endpoints. Databricks checks the service principal permissions against its catalog rules before any query runs. Data then flows back to the container as JSON or arrow batches over the network.
Good setups map one Cloud Run app to one specific Databricks service principal. This one-to-one link makes it clear which app ran a given query. Security teams can read the workspace audit logs and trace every read or write action.
Common failure modes and how to scope roles
Problems start when teams share one broad Databricks token across ten different Cloud Run apps. If one app leaks that token in a log file, an attacker gains broad reach. Shared tokens also ruin your audit trail because every app looks the same in logs. You cannot tell if a slow query came from a test app or production.
Another common risk happens when engineers debug live containers or run ad hoc SQL queries. They often copy service credentials onto their laptops to test how the app reads data. Soon, static keys sit on local disks with full write permissions to core data tables. Also, sensitive fields like emails, phone numbers, or card numbers return in plain text.
End-to-End Encryption: architecture patterns and best practices
Continue reading? Get the full guide.
Free. No spam. Unsubscribe anytime.
To fix this, give each Cloud Run service its own service principal with narrow rights. Grant read permissions only on the specific catalog schemas that the single app needs. Never give a web app admin rights over the whole workspace or cluster settings. Store any required secrets in a managed secret store and rotate them on a schedule.
Network paths and data protection rules
By default, Cloud Run containers reach out to the public internet to call external APIs. You can tighten this path by routing traffic through a virtual private cloud connector. This gives your outbound traffic fixed IP addresses or private routes to the data plane. Then you can set up IP allowlists on the Databricks side to block unknown callers.
Network rules alone do not solve every data risk during daily work and debugging. Engineers still need a safe way to inspect tables and check app queries during incidents. Applying data masking rewrites matched fields like national IDs or emails in query results. Pairing strict role scopes with clear audit logs keeps both platforms fast and safe.
Govern statements and responses across databases and APIs
Good config and scoped roles are needed setup. They do not check single queries in flight or mask sensitive fields in returned rows. Across Postgres, MySQL, SQL Server, MongoDB, ClickHouse, Kubernetes APIs, SSH, and internal HTTP endpoints, hoop.dev runs beside each supported service as an open-source proxy, a sidecar for your database or API.
First, hoop.dev guardrails block banned queries before they run. Then hoop.dev data masking rewrites matched sensitive values in responses in memory. The audit trail records every statement and verdict per resource. Furthermore, hoop.dev holds SOC 2 Type II and is open source on GitHub.
Frequently asked questions
How should Cloud Run log in to Databricks?
Use a dedicated service principal for each Cloud Run service rather than a personal token. Pass short-lived tokens or read scoped secrets from a managed secret store at runtime.
Can Cloud Run talk to Databricks over a private network?
Yes, you can link Cloud Run to your virtual network using a serverless network connector. From there, route traffic through private links or NAT gateways to reach your workspace.
How do we limit what data a Cloud Run app can read?
Grant the app service principal select permissions only on the exact tables it needs. You can also apply masking rules so queries rewrite emails or card numbers in results.
Related guides
In this post