The Simplest Way to Make Google Compute Engine and Vertex AI Work Like They Should

Published
Length
3 min read

Luis Felipe Dias

All posts

Google Compute Engine and Vertex AI work together to run your apps and machine learning models. Your virtual machines run the main app logic while the model service handles predictions and training. This setup lets teams keep heavy app workloads on standard cloud servers. At the same time, those servers can call managed AI endpoints on demand. Getting the link right requires clean identity rules and safe network paths. How google compute engine and vertex ai share data and roles Every virtua

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.

Google Compute Engine and Vertex AI work together to run your apps and machine learning models. Your virtual machines run the main app logic while the model service handles predictions and training.

This setup lets teams keep heavy app workloads on standard cloud servers. At the same time, those servers can call managed AI endpoints on demand. Getting the link right requires clean identity rules and safe network paths.

How google compute engine and vertex ai share data and roles

Every virtual machine in Google Cloud can hold a dedicated service account identity. This identity tells the cloud platform what the server is allowed to do. When your app needs a prediction, it asks the local metadata server for a token.

The metadata server hands back a short token tied to that service account. Your app then sends this token along with the prompt or data payload. The AI service checks the token against your cloud identity and permission rules.

If the role allows model calls, the endpoint processes the input and returns a response. Data flows over Google's internal network when both services stay in the same cloud region. You do not need to create static keys or save secrets on the disk.

Common failure modes and how to scope roles and networks

Many teams make the mistake of using the default compute service account. That default account often has broad editor rights across the whole cloud project. If an attacker compromises one server, they gain wide control over all project resources.

Shared service accounts create another big problem for security and operations teams. When ten different servers use one identity, your logs cannot show which app made a call. Unlogged queries also leave you blind to sensitive data leaving your database.

To fix this, create one custom service account for each specific app workload. Grant that account only the exact role needed to call the model endpoint. Turn off the default service account so nobody uses it by mistake.

AI Agent Security: architecture patterns and best practices

Continue reading? Get the full guide.

Free. No spam. Unsubscribe anytime.

Next, lock down the network path between your servers and the model endpoints. Set up private service access so traffic stays off the public internet. Use firewall rules to block servers that have no business calling AI endpoints.

How to audit model calls and protect sensitive data

Even with scoped roles, engineers sometimes log in to servers to debug production issues. During an active debugging session, a user might run test queries against production models. Standard cloud logs often record the server identity instead of the human user.

Teams need clear audit trails that tie every single action to a real person. You should enable data access audit logs for your machine learning services right away. These logs show when a principal calls an endpoint or reads training data.

You also need a plan for handling personal data inside model prompts. Before an app or user sends data out, masking rewrites matched fields in results. For example, you can mask emails, phone numbers, card numbers, and national IDs.

Keeping raw personal records out of prompts lowers your risk during daily operations. Combine strict role scoping, private network paths, and strong logging to keep your setup safe.

Add runtime guardrails and masking beside your databases and APIs

Login rules, role grants, and CI checks govern who connects to your stack. Yet any allowed script, engineer, or AI agent still runs commands with the full scope of its role. For workloads on Postgres, MySQL, SQL Server, MongoDB, ClickHouse, Kubernetes, SSH, or internal HTTP services, hoop.dev sits beside the service as an open-source proxy, a sidecar for your database or API.

Before a query runs, hoop.dev guardrails check the statement against your rules. An AI Analyzer you configure can score intent or hold risky calls for human review. Next, hoop.dev data masking rewrites sensitive fields in responses, and each verdict is logged per listener. Explore the MIT-licensed project on GitHub.

Frequently asked questions

Should I put API keys on my virtual machines to call models?

No, you should never store static keys on your cloud servers. Attach a dedicated service account to the virtual machine and use its short tokens instead.

How do I keep traffic between my servers and models off the public internet?

You can set up Private Service Connect or private Google access on your virtual network. This keeps all model requests and responses inside Google's private network backbone.

Why do my audit logs only show the server name instead of the developer?

When a developer runs commands from a shared server, requests use the machine's service account. To see the human user, require individual logins and log actions at the session level.

The query runs. The emails stay hidden.