More Info:
Ensure that Private Service Connect endpoints are configured for your Vertex AI resourcesRisk Level
MediumAddress
SecurityCompliance Standards
- CIS GCP
Triage and Remediation
- Remediation
Remediation
Using Console
Using Console
Below are step‑by‑step instructions to configure Private Service Connect (PSC) endpoints for Vertex AI using the Google Cloud Console.
Following these steps ensures your Vertex AI traffic is routed privately via Private Service Connect.
1. Prerequisites
- Make sure the following APIs are enabled in your project:
- Vertex AI API (
aiplatform.googleapis.com) - Compute Engine API (
compute.googleapis.com) - Service Networking API (
servicenetworking.googleapis.com)
- Vertex AI API (
- You must have:
- A VPC network and subnet in the region where your Vertex AI workloads run.
- Permissions:
compute.adminor equivalent, and DNS admin if you manage Cloud DNS.
2. Create a PSC endpoint for Google APIs (Vertex AI)
- In the console, go to:
Navigation menu → VPC network → Private Service Connect. - Click Create endpoint.
- Under Endpoint type, select:
- “Access Google APIs” (or similar wording like “Connect to Google APIs”).
- Configure the endpoint:
- Project: your project.
- Network: choose the VPC network your workloads use.
- Subnet: choose the subnet your workloads are in (must have free IPs).
- Region: same region where your Vertex AI resources run (e.g.,
us-central1). - Endpoint IP address: either let Google assign automatically or choose a specific internal IP from the subnet.
- In Target Google APIs:
- Choose “All Google APIs” or “Selected APIs”.
- If selecting, make sure the Vertex AI endpoint is included (
aiplatform.googleapis.comor regional endpoint likeus-central1-aiplatform.googleapis.comdepending on UI).
- Click Create and wait for the endpoint state to become Ready.
3. Configure private DNS for Vertex AI
You must route the Vertex AI API hostname(s) to your PSC endpoint’s internal IP.- In the console, go to:
Navigation menu → Network services → Cloud DNS. - Click Create zone.
- Create a private DNS zone:
- Zone type: Private.
- Name: e.g.,
vertex-ai-private-zone. - DNS name (pick one of these depending on how you access Vertex AI):
- For regional endpoints: e.g.,
us-central1-aiplatform.googleapis.com. - Or for global:
aiplatform.googleapis.com.
(Match how your clients call the API.)
- For regional endpoints: e.g.,
- Network: attach the same VPC network as your workloads.
- After the zone is created, click into it and create an A record:
- DNS name:
@(root of the zone, or leave empty in UI). - Record type:
A. - TTL: e.g.,
300. - IPv4 address: the internal IP of your PSC endpoint (from step 2).
- DNS name:
- Save the record.
4. Verify that traffic uses PSC
From a VM or GKE Pod in the same VPC/subnet:- Run a DNS lookup:
nslookup us-central1-aiplatform.googleapis.com(or your chosen hostname)
Ensure it resolves to your PSC endpoint’s internal IP.
- Call the Vertex AI API from inside the VPC:
- If DNS is correct, the call is routed via the PSC endpoint (private IP), not over the public internet.
5. Use Vertex AI resources with PSC
Once DNS is in place, no extra setting is needed in the Vertex AI resource itself. Any client (VM, GKE, Cloud Run with Serverless VPC Access connector, etc.) in that VPC that calls the Vertex AI endpoint hostname will automatically go through the PSC endpoint.If you use custom code or SDKs, ensure:- You call the same hostname for which you created the DNS zone (e.g.,
us-central1-aiplatform.googleapis.com). - You do not hardcode public IPs or bypass DNS.
Following these steps ensures your Vertex AI traffic is routed privately via Private Service Connect.
Using CLI
Using CLI
Below is a concise, CLI‑only, step‑by‑step way to set up a Private Service Connect (PSC) endpoint so your Vertex AI traffic stays on your VPC.Assumptions (adapt as needed):
Option B – all Google APIs via PSC (Vertex AI included):Use only one of the options.
5. Create a private DNS zone for
(e.g.If you also call the global endpoint
You should see:
- Project ID:
PROJECT_ID - VPC network:
VPC_NETWORK - PSC IP:
10.10.0.5(must be unused and in a subnet range routed in your VPC) - Vertex region:
REGION(e.g.us-central1)
1. Set project and variables
2. Enable required APIs
3. Reserve a global PSC address in your VPC
4. Create the PSC forwarding rule for Google APIs / Vertex AI
Option A – only Vertex AI via PSC (recommended if you want to scope it):5. Create a private DNS zone for googleapis.com
6. Create DNS records for Vertex AI endpoint
Vertex AI regional endpoint format:REGION-aiplatform.googleapis.com(e.g.
us-central1-aiplatform.googleapis.com)aiplatform.googleapis.com (no region), add:7. Verify from a VM in the VPC
From a VM inVPC_NETWORK:- DNS resolving to
10.10.0.5 - HTTP status
200or401(unauthorized is fine; it proves connectivity via PSC)
Using Python
Using Python
Below is a practical, step‑by‑step approach to ensure your Vertex AI traffic goes over a Private Service Connect (PSC) endpoint, with Python examples where the API supports it. Some PSC steps are still usually done with
Notes:
Important:
If DNS is correctly configured, no extra PSC-specific flags are required in the Vertex AI client; it simply resolves to the private IP and uses PSC.
It should return the PSC IP you created.
If you share your region and whether you want the exact service‑attachment name lookup shown via
gcloud/Terraform, but I’ll show the Python API equivalents where possible.1. Prerequisites
- A VPC network and subnet where your workloads run.
google-cloud-computeandgoogle-cloud-aiplatformlibraries installed:
- Vertex AI and Compute Engine APIs enabled for the project.
2. Identify the Vertex AI PSC Service Attachment
Vertex AI exposes regional service attachments in the producer projectservice-<PROJECT_NUMBER>@gcp-sa-aiplatform.iam.gserviceaccount.com, but you don’t need to create them; Google manages them.For PSC to Google APIs (including Vertex AI), you typically use the Google‑managed producer:servicenetworking.googleapis.comfor private services access, or- regional service attachments exposed for Vertex AI in your region (e.g.,
aiplatform.googleapis.comvia PSC).
3. Create a PSC Endpoint in Your VPC (Python)
You create:- An internal IP address.
- A PSC forwarding rule that points to the service attachment for Vertex AI in your region.
- You must use the correct service attachment name for Vertex AI in your region. Get it via
gcloud compute service-attachments list --project=<producer>or from Vertex AI PSC docs. - The endpoint is created in your consumer project’s VPC.
4. Configure DNS to Route Vertex AI Traffic to the PSC Endpoint
Create a private DNS zone soREGION-aiplatform.googleapis.com (or the host you use) resolves to the PSC IP.You can do this with the Cloud DNS API, but it’s typically easier with gcloud. Python equivalent (simplified):- Use the exact hostname that your Vertex AI client will call (e.g.
us-central1-aiplatform.googleapis.com). - Ensure this is a private zone linked to your VPC (Cloud DNS managed zone with appropriate
privateVisibilityConfigif using REST/infra as code).
5. Use Vertex AI Over PSC from Python
Once DNS is in place, your workloads in the VPC will resolve the Vertex AI regional endpoint to the PSC IP and route privately.Use the regional endpoint as usual:6. Verification
From a VM or container in the VPC:- Check DNS resolution:
- Run a simple Vertex AI call (like the
Model.list()above) and confirm:- The call succeeds.
- In VPC Flow Logs (if enabled), traffic to the PSC IP (TCP/443) is visible, not to public IPs.
If you share your region and whether you want the exact service‑attachment name lookup shown via
gcloud, I can tailor the service_attachment field precisely for your case.
