Quick answer
VPC Service Controls protect Vertex AI by placing your AI projects inside a service perimeter that restricts aiplatform.googleapis.com and the data services it uses, such as Cloud Storage and BigQuery. Requests from outside the perimeter are blocked, and data can't be copied to resources outside it — even with valid credentials. Roll out in dry-run mode first, review violations, add explicit ingress and egress rules, then enforce.
Key takeaways
- IAM decides who can call an API. VPC Service Controls decide from where, and where data can go.
- Restrict Vertex AI together with the data services it reads from. A perimeter around the model alone leaves the data exposed.
- Always start in dry-run mode. Enforcing a perimeter blind is the fastest way to break production.
- Most rollout problems come from CI/CD pipelines, console access and cross-project service accounts.
On Google Cloud, IAM answers who can call Vertex AI. It doesn't answer from where, or where the data can go next. A leaked service account credential used from an attacker's laptop passes IAM just fine. VPC Service Controls close that gap — and it's the control we most often find missing in Google Cloud AI environments.
What a service perimeter does
A service perimeter is a boundary around a set of projects. For the Google APIs you mark as restricted:
- Requests from outside the perimeter are blocked unless an ingress rule or access level allows them.
- Data can't move from resources inside the perimeter to resources outside it unless an egress rule allows it.
For AI, that means someone holding valid credentials still can't call your Vertex AI endpoints from an unknown network, or copy your tuning data, embeddings or prediction logs to a bucket they control.
Step 1: decide what goes inside
Projects: every project that runs Vertex AI workloads or stores the data they use. If your training data is in a shared data project, that project belongs inside too.
Restricted services: start with these:
| Service | Why |
|---|---|
aiplatform.googleapis.com | Vertex AI: models, endpoints, pipelines, RAG |
storage.googleapis.com | Training data, documents, model artifacts |
bigquery.googleapis.com | Feature data, prediction and evaluation logs |
notebooks.googleapis.com | Vertex AI Workbench, if used |
artifactregistry.googleapis.com | Custom training and serving containers |
Check which Gemini API your teams use. The Gemini Developer API (generativelanguage.googleapis.com, often used with Google AI Studio keys) is a different service from Gemini on Vertex AI. Standardize production workloads on Vertex AI, where enterprise controls like VPC Service Controls, CMEK and IAM apply — and look for stray API keys as part of your shadow AI review.
Step 2: create the perimeter in dry-run mode
gcloud access-context-manager perimeters dry-run create ai_perimeter \
--perimeter-title="AI workloads" \
--perimeter-type=regular \
--perimeter-resources=projects/PROJECT_NUMBER \
--perimeter-restricted-services=aiplatform.googleapis.com,storage.googleapis.com,bigquery.googleapis.com \
--policy=ACCESS_POLICY_ID
Nothing is blocked yet. Every request that would be blocked is written to Cloud Logging as a VPC Service Controls dry-run violation.
Step 3: review violations for at least a week
Query the audit logs for dry-run violations and group them by caller and service. You'll typically find:
- CI/CD pipelines deploying models or containers from a project or runner outside the perimeter.
- People using the console or notebooks from corporate networks or home.
- Cross-project service accounts, such as a data pipeline in another project writing to a training bucket.
- Third-party tools — observability, labeling or MLOps vendors that call your APIs.
Some of these are legitimate and need rules. Some are exactly the unexpected access you wanted to find.
Step 4: add explicit ingress and egress rules
For each legitimate flow, add the narrowest rule that allows it — a specific identity, to a specific service and method, from a specific source. Use access levels (for example, corporate IP ranges or managed devices) for human console access. Avoid broad rules like "any identity from anywhere," which quietly undo the perimeter.
Step 5: enforce, then monitor
gcloud access-context-manager perimeters dry-run enforce ai_perimeter \
--policy=ACCESS_POLICY_ID
After enforcement, keep alerting on violation logs. New violations usually mean a new workload that needs onboarding — or an attempt you should investigate.
Pair it with the rest of the baseline
A perimeter is strongest alongside its neighbors: blocked service account key creation, CMEK on Vertex AI resources, Model Armor screening prompts and responses, and Data Access audit logs for aiplatform.googleapis.com. All of these are covered in our Google Cloud secure AI deployment baseline, where a VPC Service Controls perimeter is a required control.
Frequently asked questions
What does VPC Service Controls protect against?
Data exfiltration through Google Cloud APIs. Even if an attacker or insider has valid credentials, a service perimeter blocks API calls that originate outside the perimeter and prevents copying data from protected resources to projects outside it — for example, exporting a training dataset to a personal bucket.
Which services should be in a Vertex AI service perimeter?
At minimum aiplatform.googleapis.com plus the services holding the data your AI uses — typically storage.googleapis.com and bigquery.googleapis.com. Add others your AI workloads depend on, such as notebooks.googleapis.com for Workbench and artifactregistry.googleapis.com for custom containers.
What is dry-run mode in VPC Service Controls?
Dry-run mode evaluates a perimeter configuration and logs every request that would have been blocked, without actually blocking anything. It lets you find the legitimate traffic that needs ingress or egress rules before you enforce the perimeter.
Get certified against the leaks covered in this article
CertiSafe AI tests your live AI features every quarter and gives you a verifiable stamp for your website.