AI, LLM and real-time · Google Cloud

LLM inference on Google Cloud with Vertex AI, Cloud Run and VPC Service Controls

A private, governed Gemini and Model Garden inference platform: Cloud Armor at the edge, Cloud Run for the application, Vertex AI over Private Service Connect, Pub/Sub for async jobs and BigQuery for audit and cost analytics.

A reference architecture from EITSAA, not a named client system. Service limits, prices and product features change, so confirm current details before you commit to a design.

  • Australian Privacy Principles (APP 11)
  • ACSC Essential Eight
  • Google Cloud Sydney (australia-southeast1) and Melbourne (australia-southeast2)

Architecture

Architecture diagram. Tinted boundaries show regions, accounts, networks and trust zones. Numbered arrows match the flow below.
LLM inference on Google Cloud with Vertex AI, Cloud Run and VPC Service Controls architectureStaff and apps to External Application LB: HTTPS. External Application LB to Cloud Run service: serverless NEG. Cloud Run service to Vertex AI Search or AlloyDB: retrieve. Cloud Run service to Private Service Connect: private. Private Service Connect to Vertex AI: generate. Cloud Run service to Pub/Sub: batch. Cloud Run service to BigQuery: log. Cloud Run service to Secret Manager + Cloud KMS: secrets, CMEKUsersGoogle Cloud project · australia-southeast1VPC Service Controls perimeterStaff and appsOIDC via Cloud IdentityExternal ApplicationLBCloud Armor, managed TLSCloud Run serviceLLM gateway and app logicPrivate ServiceConnectTo Google APIsVertex AIGemini, Model GardenPub/SubAsync and batch jobsVertex AI Search orAlloyDBVector and hybrid retrievalBigQueryRequest audit, cost, evalsSecret Manager +Cloud KMSCMEK, secrets1HTTPS2serverless NEG3retrieve4private5generate6batch7logsecrets, CMEKPlatform servicesCloud IAMCloud Loggingand MonitoringCloud KMSSecurity CommandCenter
  • People and clients
  • Network and edge
  • Compute and containers
  • AI and ML
  • Messaging, events and workflow
  • Databases and data
  • Security and identity
  • Monitoring, audit and analytics
  • Request or data flow
  • Asynchronous or optional
  • Boundary: region, account, network or trust zone

Request and data flow

  1. Users reach a global external Application Load Balancer. Cloud Armor applies WAF rules, rate limits and optional geo controls, and managed certificates terminate TLS.

  2. A serverless network endpoint group routes to Cloud Run. Identity-Aware Proxy or application-level OIDC authenticates users, and ingress is set to internal and load-balancer only.

  3. The service authenticates the user, applies quotas and retrieves context from Vertex AI Search, AlloyDB with pgvector or another store, using the caller's permissions.

  4. Calls to Vertex AI go through Private Service Connect for Google APIs so traffic stays on Google's private network, from a service account with only the aiplatform.user role.

  5. Vertex AI serves Gemini or a Model Garden model from a regional endpoint. The VPC Service Controls perimeter blocks data exfiltration to projects outside the perimeter.

  6. Long-running or batch work is published to Pub/Sub and processed by Cloud Run jobs or workers, with dead-letter topics for failures.

  7. Request metadata, token counts, latency, safety ratings and evaluation scores stream to BigQuery for audit, cost allocation and quality monitoring. Prompts and responses are logged only where policy permits.

Components and why they were chosen

ComponentWhat it doesWhy this choice
Cloud Armor and external Application Load BalancerWAF, DDoS protection, rate limiting and TLS.Protects a public endpoint before any compute is invoked.
Cloud RunContainerised gateway and application, scaling to zero.Low operations, per-request scaling and fine-grained IAM invoker control.
Vertex AI (Gemini)Managed foundation models with safety settings, grounding and function calling.Enterprise controls and regional endpoints. Confirm model availability and data-processing location for your chosen region.
Vertex AI Model GardenOpen and partner models you can deploy to dedicated endpoints.Use when you need a specific open model or dedicated capacity.
Private Service ConnectPrivate endpoints for Google APIs.Keeps API traffic off the public internet and works with on-premises connectivity.
VPC Service ControlsPerimeter around data and AI services.Strong exfiltration control, though it needs careful rule design for ingress and egress.
Pub/SubAsync messaging with retries and DLQs.Decouples slow generations from user requests.
BigQueryAnalytics on usage, cost and quality.Serverless SQL for dashboards and audits.
Cloud KMS (CMEK) and Secret ManagerCustomer-managed keys and secrets.Control and audit of encryption.

Design decisions and trade-offs

Where the model runs

Vertex AI managed endpoints, dedicated endpoints for open models when needed.

Why. No GPU operations for most use cases.

Trade-off. Model and feature availability differs by region, and you must check residency per model.

Connectivity

Private Service Connect plus VPC Service Controls.

Why. Private path and exfiltration protection.

Trade-off. Perimeter rules take effort and can block legitimate integrations until tuned.

Application platform

Cloud Run over GKE.

Why. Less to run, fast scaling.

Trade-off. Less control for long-lived connections or custom networking, where GKE fits better.

Gateway

A thin LLM gateway layer (quotas, redaction, routing) in Cloud Run or Apigee.

Why. One control point for cost and policy across models.

Trade-off. Another component to maintain, and it must be fast.

Logging prompts

Log metadata by default and prompts only with a purpose and retention.

Why. Prompts hold personal information.

Trade-off. Harder debugging without sample capture, so use consented samples.

Well-architected pillars

Security

Cloud Armor, IAM least privilege with service accounts, VPC-SC perimeter, CMEK, Secret Manager, and Model Armor or safety filters for prompt and response screening.

Reliability

Regional services with retries and fallbacks to a second model or region, Pub/Sub DLQs, and quota monitoring.

Performance

Streaming responses, context caching where supported, regional endpoints near users, and concurrency tuned on Cloud Run.

Cost optimisation

Tokens per request dominate. Control them with quotas, caching, routing to smaller models and BigQuery cost attribution.

Operational excellence

Terraform, Cloud Build or GitHub Actions with workload identity federation, SLOs in Cloud Monitoring.

Sustainability

Serverless scale to zero and right-sized models.

Network, identity and data

Networking

Cloud Run with ingress restricted to the load balancer and egress through a Serverless VPC connector or direct VPC egress into a VPC with Private Google Access or PSC. No public IPs on workloads. Hybrid connectivity by Cloud Interconnect or VPN if needed.

Identity and least privilege

Workforce identity via Cloud Identity or federation from Entra ID. Service accounts per service with minimum roles. No service account keys, using workload identity federation for CI. IAM Conditions for environment scoping.

Data and encryption

Classify data before sending to a model. Use CMEK where policy requires, keep processing in Australian regions where models support it, and confirm Google's data-use terms for the product. Sensitive Data Protection (DLP) can redact before calls.

Security and compliance mapping

ControlHow this design addresses it
Restrict administrative privilegesRole design and no key files. Essential Eight.
Multi-factor authenticationEnforced at the identity provider. Essential Eight.
Data exfiltration controlVPC-SC perimeter supports ISM guidance on boundary protection.
PrivacyRedaction, regional processing and retention support APP 8 and APP 11.

Mappings show how the design supports each control. They are not certifications, and EITSAA does not claim IRAP assessment or compliance for any reference architecture.

Failure modes, targets and scaling

  • Target RTOUnder an hour from code
  • Target RPOBigQuery and stores per their own backups. Inference is stateless
  • Scaling and limitsGoverned by Vertex AI quotas per model and region, which you request in advance.
Failure modeMitigation
Model quota or regional capacity limitQuota alerts, retry with backoff and fallback model or region.
Prompt injection through retrieved contentModel Armor or safety filters, content isolation and tool restrictions.
Perimeter blocks a legitimate flowDry-run mode, VPC-SC logs and staged rollout.
Runaway cost from a loopPer-user and per-key quotas and budget alerts.

Observability and runbooks

  • Cloud Monitoring SLOs for latency and error rate.
  • BigQuery dashboards for tokens, cost and safety blocks.
  • Evaluation runs with Vertex AI evaluation or your own golden set on every prompt change.

Cost drivers and levers

Input and output tokens, dedicated endpoint hours, retrieval stores and egress.

  • Route by task to smaller Gemini models.
  • Cache context and answers.
  • Limit output tokens.
  • Batch non-urgent work.

Implementation and fit

Phased approach

  1. Landing zone with perimeter in dry-run and a sandbox project.
  2. Gateway on Cloud Run with one model and logging.
  3. Add retrieval, guardrails and evaluation.
  4. Enforce the perimeter and roll out to users.

Anti-patterns to avoid

  • Calling Vertex from the browser.
  • Service account keys in CI.
  • One shared service account.
  • No budget alerts.

When to use it

  • Organisations standardised on Google Cloud or Workspace.
  • Apps needing long-context or multimodal Gemini models.

When not to

  • Teams with no Google Cloud skills and a Microsoft-only estate.
  • Where model availability in Australian regions does not meet policy.

More in ai, llm and real-time

Related insights

Discuss this architecture

Tell us your systems, constraints and timeline. We reply within one business day, and the initial conversation is free.