The Simplest Way to Make BigQuery and Sagemaker Work Like They Should
Teams pair bigquery and sagemaker to train machine learning models on warehouse data. Data stays in Google Cloud while Amazon compute runs the training jobs. This cross-cloud setup lets data scientists use their favorite tools in both clouds. Yet linking two giant cloud providers creates hard security and identity problems. Engineers often paste static keys into notebooks just to make the link work. A safe setup needs federated identity, tight roles, and clear query logs. How authentication a
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.
Teams pair bigquery and sagemaker to train machine learning models on warehouse data. Data stays in Google Cloud while Amazon compute runs the training jobs.
This cross-cloud setup lets data scientists use their favorite tools in both clouds. Yet linking two giant cloud providers creates hard security and identity problems. Engineers often paste static keys into notebooks just to make the link work. A safe setup needs federated identity, tight roles, and clear query logs.
How authentication and data flow work in bigquery and sagemaker
Moving data from Google Cloud to Amazon Web Services starts with identity. In a basic setup, a user creates a Google service account key. They save that JSON key inside Amazon secrets or directly on the notebook. The notebook reads the key and sends a query to the warehouse. Then the warehouse sends rows back over the public web or a peering link.
A better pattern uses workload identity federation between the two cloud providers. The compute instance assumes an Amazon role when it starts up. Google Cloud checks that Amazon token and swaps it for a short token. No one has to download or store a long-lived JSON file.
Data transfer speed also matters when training jobs read millions of rows. Standard queries work well for small tables and quick tests. For huge datasets, teams use the storage read API to stream data fast. Some teams also export tables to cloud buckets before the training run starts. Each path needs explicit read permissions on the dataset and the project.
Common failure modes and how to scope roles and network paths
The biggest risk in this setup is the shared notebook service account. One team sets up a single role with broad warehouse admin rights. Every data scientist on the team uses that same role for daily work. When a bad query runs, the logs only show the shared account name. Security teams cannot tell which person or job ran the query.
Broad tokens also expose sensitive customer columns during model training runs. A training script might pull email addresses, phone numbers, or card numbers by mistake. Once those fields land in a notebook file, they are hard to track. Data masking rules can rewrite matched fields in results before they reach notebooks. This keeps sensitive strings out of model weights and local disk storage.
BigQuery IAM + End-to-End Encryption: architecture patterns and best practices
Continue reading? Get the full guide.
Free. No spam. Unsubscribe anytime.
To fix role sprawl, give each project or job its own tight role. Grant read access only to the exact tables needed for that model. Separate human notebook roles from automated training job roles in both clouds. Do not let a notebook role create new tables in production datasets.
Auditing cross-cloud queries and notebook sessions
Good security requires a clear trail from the model back to the data. When two clouds talk, logs end up split across two separate consoles. Amazon logs show when the notebook started and which role it used. Google logs show the SQL text and the bytes billed for the job.
Teams should pass job tags or labels along with every warehouse query. These labels link the warehouse job ID back to the specific training run. If a job spikes costs, you can find the exact notebook right away. Regular checks on these logs help teams spot unused roles and drop them.
Check database and API queries on the wire
Identity tools, roles, and network rules decide who opens a session. Setup alone cannot check what each query does or mask sensitive values in a response once a session starts. When workflows touch Postgres, MySQL, SQL Server, MongoDB, ClickHouse, Kubernetes APIs, SSH, or internal HTTP APIs, hoop.dev runs beside those services as an open-source proxy, a sidecar for your Postgres or API. It inspects requests coming in and results going back on the wire.
Your login details and client tools stay as they are while hoop.dev guardrails refuse bad deletes or drops before they run. On responses, hoop.dev data masking rewrites matched sensitive values in memory. Furthermore, hoop.dev holds SOC 2 Type II, is MIT licensed, and writes every query and decision to an audit trail that generates evidence for HIPAA, GDPR, and PCI DSS. See the source on GitHub.
Frequently asked questions
How do I avoid storing Google JSON keys in Amazon notebooks?
Use workload identity federation to link your Amazon role to a Google service account. This lets the notebook trade its local token for temporary access without static keys.
Why can I not see which data scientist ran a warehouse query?
Your notebooks likely share a single service account for all database calls. Map individual user identities to queries or assign distinct roles per user session.
How do I protect PII columns during machine learning training runs?
Scope the role to clean views or apply data masking to the query stream. Masking rewrites matched fields like emails or phone numbers in results before training starts.
Related guides
In this post