Google Cloud Platform Services and Architecture Questions
Google Cloud Platform's core services and architecture: Compute Engine, Cloud Run, GKE, Cloud Storage, VPC, managed databases (Cloud SQL, Spanner, Firestore, Bigtable), and BigQuery-adjacent data services. Covers GCP service selection, networking, IAM and security specifics, cost and quota management, and reference patterns for building on the platform. For provider-agnostic compute, storage, or networking concepts, see the cross-cloud entries.
Design the HTTP(S) load balancing and Cloud CDN setup for a global web application that serves a mix of static assets from Cloud Storage and a dynamic API from GKE. Cover SSL termination, session affinity, cache key design and invalidation, signed URLs for private assets, and how you would route traffic to the nearest backend while keeping some data in one region for residency reasons.
Sample Answer
Direct answer
One global external Application Load Balancer in front of a URL map that splits traffic by path, a Cloud-CDN-enabled backend bucket for static assets and a backend service pointing at GKE-based (Google Kubernetes Engine) Network Endpoint Groups (NEGs, the load balancer's pointer to a set of backend pods or instances) for the dynamic API, gives a single global anycast entry point (anycast means the same IP address is advertised from many locations at once, so each user's traffic naturally routes to the nearest one), automatic routing to the nearest healthy backend, and a natural place to carve out a region-pinned exception for data-residency needs, without separate infrastructure per region for the common case.
Decision framework and design
- SSL termination: terminate SSL/TLS at the load balancer itself, at Google's global edge, so each user's handshake happens close to them rather than at a single origin region; traffic from the load balancer to GKE backends can run as plain HTTP within Google's network, or re-encrypted, depending on the internal security posture required.
- Cache key design and invalidation for the static path: normalize the cache key to the query parameters that actually matter, prefer content-hashed immutable filenames for assets that change on deploy, and reserve manual path-based invalidation for the rare case something needs to be pulled before its TTL (time-to-live) expires.
- Signed URLs for private assets: for static content that isn't meant to be public, user-uploaded files, gated downloads, keep the backend bucket private and require a signed URL, so the only path to the object is through the load balancer and CDN with a valid signature, never directly against the storage API.
- Session affinity: the dynamic API backend can use session affinity, client-IP-based or a generated cookie, if it genuinely needs it, but the stronger design keeps the API stateless by externalizing session data to a shared store such as Memorystore, since affinity works against even load distribution and complicates autoscaling; reach for it only for something that can't reasonably be made stateless, such as a long-lived WebSocket connection.
- Routing to the nearest backend: the global external Application Load Balancer does this automatically via its own health checks and Google's network, sending each user to their nearest healthy backend with no extra configuration, a meaningful advantage over stitching together several regional load balancers with DNS.
- Data residency for one region: add a distinct URL map rule, by path or by a header identifying the tenant or region, that routes that traffic to its own backend service pointing only at NEGs in the required region, backed by a database and any dependent services also confined to that region. The rest of the app keeps routing globally to the nearest region as normal, keeping the residency requirement scoped to exactly the traffic that needs it.
Worked example
flowchart LR
U[Users worldwide] --> LB[Global external Application Load Balancer]
LB --> CDN[Cloud CDN cache for static path]
CDN --> BB[Backend bucket: Cloud Storage]
LB --> BS[Backend service for api path]
BS --> NEG1[GKE NEG region A]
BS --> NEG2[GKE NEG region B]
LB --> BSEU[Backend service EU tenant only]
BSEU --> NEGEU[GKE NEG EU region data resident]
A user in Frankfurt requests the homepage, and separately an enterprise customer contractually required to keep its data in the EU accesses its tenant-specific dashboard. The homepage's static assets serve from Cloud CDN's European edge cache after the first request from that region warms it, and the homepage's dynamic API calls route through the load balancer's default path to whichever healthy NEG across regions is nearest and healthy, most likely a European GKE cluster, with no per-request configuration needed. The EU tenant's dashboard traffic matches a distinct URL map rule keyed on that tenant, a path prefix or a header set by the frontend, and always routes to the EU-only backend service regardless of where an individual employee of that tenant happens to be connecting from, satisfying the residency requirement even while traveling outside the EU.
Trade-offs and pitfalls
Common misconfigurations to check first when this design doesn't behave as expected:
- Forgetting explicit Cache-Control headers on the dynamic API's own responses is a frequent, dangerous misconfiguration: without them, a caching layer sitting in front of both paths can accidentally cache a personalized or sensitive API response meant for one user and serve it to another; verify the API path is either excluded from CDN caching or explicitly marked non-cacheable.
- Enabling Cloud CDN on the backend bucket but leaving the underlying Cloud Storage bucket publicly readable defeats any signed-URL protection, since the object can still be fetched directly from the storage API, bypassing the load balancer entirely.
- A mismatched or missing health check on the GKE NEG backend is a very common cause of unexplained 502 errors after this kind of setup goes live; verify the health check path and expected response match what the application actually serves.
- Session affinity, once turned on for the API backend, quietly undermines even load distribution and can mask autoscaling problems, a hot instance staying hot because affinity keeps sending it the same clients; avoid it unless there's a specific, tested reason it's required.
- The residency-specific URL map rule is easy to get wrong in a way that fails silently: a routing condition too broad or too narrow either leaks non-EU traffic into the EU-only backend, a capacity and cost problem, or leaks the tenant's traffic into the general backend, a compliance problem; test both matching and non-matching cases explicitly.
You need to connect an on-prem datacenter to GCP for a hybrid application that requires 1 Gbps sustained throughput and under 10ms round-trip time. Compare HA Cloud VPN and Dedicated Interconnect for this, and propose an architecture that includes redundancy and failover.
Sample Answer
Direct answer
The throughput requirement, 1 Gbps sustained, is comfortably within HA VPN's per-tunnel capability on paper, but the latency requirement, under 10ms round-trip time (RTT), is the one that actually decides this: HA VPN runs over the public internet, where RTT depends on internet peering paths outside GCP's control, while Dedicated Interconnect is a direct physical cross-connect that bypasses the public internet entirely, so it's the only one of the two that can reliably guarantee a low, stable RTT. The recommended architecture is Dedicated Interconnect as the primary path, with redundant circuits for availability, and HA VPN kept as a backup path that's explicitly allowed to miss the latency target during the rare window it's actually carrying traffic.
Decision framework
- Throughput math for HA VPN: each HA VPN tunnel is capped at 250,000 packets per second (pps) for combined ingress and egress traffic, a ceiling that translates into a bandwidth figure depending on average packet size.
At a representative 1,200-byte average packet size, a single tunnel can theoretically clear the stated 1 Gbps requirement, so throughput alone doesn't rule out HA VPN. A smaller average packet size lowers that ceiling, and HA VPN's standard two-tunnel active-active configuration, needed anyway for its 99.99% SLA (service-level agreement), provides real headroom above 1 Gbps regardless.
- Latency is the real constraint: achieving a reliable sub-10ms RTT over the public internet is possible only if the on-prem site happens to be very close, in network terms, to a well-peered Google entry point, not an assumption to design around. Dedicated Interconnect's physical cross-connect at a colocation facility avoids the public internet path entirely, giving a round-trip time that depends mainly on the physical distance between the on-prem site and the interconnect facility, the only one of the two architectures that can be engineered to reliably meet a hard sub-10ms target.
- Redundancy and failover: provision at least two Dedicated Interconnect connections in different edge availability domains (the 99.9% SLA tier) or, if the requirement justifies the added cost, across two metros for the 99.99% tier, with Cloud Router running BGP (Border Gateway Protocol, the routing protocol used to exchange reachable network ranges between the on-prem router and GCP) on each. Configure HA VPN as a genuinely separate backup path, with less-preferred BGP routing metrics so it only carries traffic when both Interconnect paths are down, and treat that failover window as an explicit, disclosed exception to the latency target rather than a silent gap: RTT will be worse than 10ms during that window, and that trade-off needs to be agreed with the business up front.
Worked example
flowchart LR
ONPREM[On-prem router] --> IC1[Dedicated Interconnect edge domain A]
ONPREM --> IC2[Dedicated Interconnect edge domain B]
ONPREM --> VPN[HA VPN gateway as backup path]
IC1 --> CR[Cloud Router running BGP]
IC2 --> CR
VPN --> CR
CR --> VPCN[GCP VPC and application]
For the stated 1 Gbps and sub-10ms requirement, provision a 10-Gbps Dedicated Interconnect circuit, well above the 1 Gbps sustained need, in two edge availability domains within the same metro as the on-prem site, giving the 99.9% redundant SLA tier without requiring a second physical location. Cloud Router on each connection exchanges routes via BGP, and HA VPN is configured as a lower-priority backup route for the rare case both Interconnect paths fail simultaneously. As a related scenario worth flagging: if the actual sustained requirement were 10 Gbps instead of 1 Gbps, a single 10-Gbps circuit would be sized with exactly zero headroom against the requirement, a real risk during any burst above baseline or during a failover event that concentrates traffic onto one remaining circuit. At 10 Gbps sustained, the right move is either two bonded 10-Gbps circuits or a single 100-Gbps circuit, so the requirement itself doesn't consume the entire available margin.
Trade-offs and pitfalls
- Treating the throughput number as the binding constraint and stopping the analysis there is the most likely mistake here: the math shows HA VPN can plausibly carry 1 Gbps, but the latency requirement is what actually rules it out as the primary path, and a design that satisfies throughput while ignoring latency fails the stated requirement anyway.
- Sizing the Dedicated Interconnect circuit exactly to the 1 Gbps requirement, with no headroom, repeats the same margin problem the 10-Gbps case above illustrates at a different scale.
- Presenting HA VPN as a backup path without disclosing that failover means accepting worse latency for the failover window is a common way this design surprises the business later; state that trade-off explicitly in the proposal, not as a footnote discovered during an incident.
- The pps-based throughput ceiling depends on packet size, which the application's own traffic pattern controls; a workload sending mostly small packets gets meaningfully less throughput per tunnel than the 1,200-byte assumption used here, so this calculation should be revisited against the actual traffic, not assumed.
Design secure, low-latency hybrid connectivity between on-prem datacenters and multiple GCP regions. Cover when you'd reach for Dedicated Interconnect, Partner Interconnect, or Cloud VPN, how BGP routing and failover would work, and how you'd limit the blast radius if the on-prem network were compromised.
Sample Answer
Direct answer
Treat hybrid connectivity to multiple regions as a hub-and-spoke problem, not a set of point-to-point links: use Network Connectivity Center (Google's hub product for wiring multiple hybrid connections and VPC networks, that is Virtual Private Clouds, GCP's own private network layer, together with centralized route management) as the hub that on-prem connects into once, with Dedicated or Partner Interconnect (a private physical or partner-provided link between on-prem and Google's network, bypassing the public internet) as the primary spokes and HA VPN as backup, and treat the on-prem side as untrusted by default, limiting what a compromised on-prem network can actually reach through deliberately narrow route advertisement and a firewalled transit boundary, not through the connectivity product's own security.
Decision framework
- Choosing among Dedicated Interconnect, Partner Interconnect, and Cloud VPN follows the same bandwidth, latency, private-path, and colocation-access criteria as a single-region hybrid design, applied per site: a large on-prem location with sustained bandwidth needs and colocation access gets Dedicated Interconnect; a site without colocation access but needing a private path uses Partner Interconnect through a supported provider; Cloud VPN fills in as backup everywhere and as the primary for smaller or lower-priority sites where Interconnect's fixed cost isn't justified.
- Reaching multiple GCP regions from those connections: rather than provisioning a separate physical connection per region, connect on-prem into a hub, Network Connectivity Center, which lets each Interconnect or VPN attachment, a spoke, reach every VPC also attached to the hub, including VPCs in different regions, without a full mesh of direct connections between every site and every region. This centralizes route management in one place instead of duplicating routing policy across many point-to-point links.
- BGP routing and failover: Cloud Router runs BGP (Border Gateway Protocol, the routing protocol used to exchange reachable network ranges) sessions with the on-prem router or routers over each VLAN attachment (Interconnect) or tunnel (VPN), exchanging reachable IP ranges dynamically rather than relying on static routes that need manual updates as the network changes. Configure redundant Cloud Routers and redundant physical paths so no single router or circuit failure drops BGP entirely, and use route priority, MED (a BGP attribute expressing a preference between multiple paths to the same destination), so Interconnect paths are preferred and HA VPN only carries traffic when Interconnect is unavailable. Enabling BFD (Bidirectional Forwarding Detection, a lightweight protocol that detects a link failure faster than waiting for BGP's own hold timer to expire) alongside BGP meaningfully speeds up failover detection compared to BGP alone.
- Limiting blast radius if the on-prem network is compromised: because this is a routed Layer 3 connection, the network path itself forwards whatever traffic the routing tables allow, so the real control is in what gets advertised and what gets firewalled, not in the interconnect or VPN product itself.
- Advertise only the specific destination ranges each spoke actually needs to reach, rather than the default of advertising every subnet in every connected VPC; a compromised on-prem network should not be able to route to GCP subnets it has no legitimate reason to reach.
- Land the Interconnect and VPN attachments in a dedicated transit VPC, the hub, not directly into workload VPCs, and use hierarchical firewall policies, rules applied at the organization or folder level above individual VPC firewall rules, at that transit boundary to allow only specific ports and protocols from the on-prem CIDR range (Classless Inter-Domain Routing, the notation for an IP address range, such as 10.0.0.0/16), denying everything else by default.
- Don't rely on network location as the only trust signal: require service-to-service authentication, mutual TLS or an equivalent identity check, for anything crossing the hybrid boundary, so a packet that does make it through the network path still has to authenticate at the application layer.
- Instrument the transit VPC specifically with VPC Flow Logs and firewall rule logging, watching for anomalous volume or unexpected destinations originating from the on-prem CIDR, the fastest way to detect a compromise actually being exploited through this path rather than finding out from its downstream effects.
- Have a tested circuit-breaker runbook: because the ultimate containment boundary here is the BGP route advertisement and the VLAN attachment itself, know in advance exactly how to withdraw the compromised routes or disable the attachment quickly, rather than working that out for the first time during an actual incident.
Worked example
flowchart LR
ONPREM[On-prem network] --> HUB[NCC hub transit VPC]
ONPREM --> VPNB[HA VPN backup path]
VPNB --> HUB
HUB --> FW[Firewall policy deny by default boundary]
FW --> SPOKE1[Spoke VPC region A workloads]
FW --> SPOKE2[Spoke VPC region B workloads]
FW --> MON[Flow logs and anomaly monitoring]
An enterprise with one large on-prem data center needs low-latency access to workloads split across two GCP regions. Rather than building a separate Interconnect circuit into each region, it provisions redundant Dedicated Interconnect circuits into Network Connectivity Center as the hub, with each region's VPC attached as a spoke. Cloud Router advertises only the specific subnet ranges each region's workloads actually need reachable from on-prem, not the full VPC address space, and a folder-level firewall policy on the hub allows only the specific application ports the on-prem systems legitimately call, denying everything else. When VPC Flow Logs later show an unexpected, high-volume connection attempt from an on-prem host to a database subnet it has no advertised route to reach, the request is dropped at the routing layer before it ever reaches a firewall rule to evaluate, and the flow log entry itself becomes the detection signal that something on the on-prem side is behaving abnormally, triggering the incident runbook rather than a successful lateral-movement attempt.
Trade-offs and pitfalls
- Advertising a full default route set, everything in every VPC, because it's the easiest way to make connectivity just work, is the single biggest blast-radius mistake in this design; it trades away exactly the containment property the question is asking for, in exchange for slightly less route configuration up front.
- Landing Interconnect or VPN attachments directly into workload VPCs instead of a dedicated transit VPC removes the one clean chokepoint where a firewall policy can inspect and restrict all hybrid traffic in one place; retrofitting that separation later is a much larger project than designing it in from the start.
- Treating BGP's dynamic routing as purely a convenience feature, without also configuring MED-based path preference and BFD, leaves failover slower and less predictable than it needs to be, and "it failed over eventually" is a weak answer when a stakeholder asks how long a regional path outage actually degraded traffic.
- A well-designed network boundary without an actual tested incident runbook for withdrawing routes or disabling an attachment is a plan that only exists on paper; the first time anyone tries to execute it should not be during a live compromise.
Design a secure way for serverless workloads on Cloud Run or Cloud Functions to reach a resource inside a VPC, such as a Cloud SQL instance, while minimizing exposure. What are the options (Serverless VPC Access, Private Service Connect, NAT, peering) and how would you choose between them?
Sample Answer
Direct answer
For Cloud Run or Cloud Functions reaching a Cloud SQL instance or anything else inside a Virtual Private Cloud (VPC), the current default recommendation is Direct VPC egress: it routes the service's outbound traffic straight into your VPC without a separate always-on connector, scales network capacity with the service itself, and is the simplest thing to reason about for a new design. Reach for a Serverless VPC Access connector instead in the one documented case where Direct VPC egress has a known cold-start problem: when the same egress path also goes through Cloud NAT. Google's own Cloud Run documentation calls out cold-start delays of 30 seconds or more on instance startup in that specific combination and recommends a connector with Cloud NAT for better startup performance, rather than a general claim that connectors beat Direct VPC at high request volume. Use Private Service Connect specifically when the destination is a managed service like Cloud SQL or a partner/producer service you want to reach by private IP without exposing it, rather than plain VPC connectivity. Cloud NAT and VPC peering are not choices for this specific problem: they solve the opposite direction (your VPC reaching the internet, or two VPCs reaching each other), not a serverless product reaching into a VPC.
Structured elaboration
Serverless VPC Access (the connector)
- A small, dedicated set of VM instances that sit in your VPC and act as a bridge: Cloud Run or Cloud Functions sends VPC-bound traffic to the connector, which forwards it into the subnet.
- Costs money even when idle (a minimum instance count is always running), and adds a hop, but is a long-established, well-understood path. Google's own guidance does not say the connector generally beats Direct VPC on latency under high load; the specific, documented case is Direct VPC egress paired with Cloud NAT, where Google's own docs report cold-start delays of 30 seconds or more on instance startup and recommend switching to a connector with Cloud NAT for better startup performance instead.
Direct VPC egress
- Cloud Run (and now Cloud Functions deployed as 2nd-generation, which runs on Cloud Run's infrastructure) can attach directly to a VPC subnet without a connector; there is no idle connector cost, and network capacity scales to zero along with the service itself.
- This is the newer, generally recommended default for most workloads precisely because it removes a piece of standing infrastructure you'd otherwise have to size and pay for.
Private Service Connect (PSC)
- Solves a different part of the problem: reaching a managed service, such as a Cloud SQL instance, by a private IP address inside your VPC rather than the instance's default public-or-peered-network path, and without needing VPC peering to Google's managed-services network at all.
- For Cloud SQL specifically, PSC is the modern alternative to the older private-services-access (VPC peering-based) connection method; it avoids the shared, harder-to-reason-about peering range that private-services access consumes from your VPC.
Cloud NAT and peering (why they're not the answer here)
- Cloud NAT lets resources without a public IP reach the internet outbound; it is not a mechanism for a serverless product to reach a private resource, so it plays no role in this specific connectivity problem.
- VPC peering connects two VPC networks to each other; it's what private-services access uses under the hood to reach some managed services, but you would not hand-roll peering yourself for this use case when Direct VPC egress or a connector already exists as the supported path.
Worked example
A backend on Cloud Run needs to reach a Cloud SQL Postgres instance for OLTP (online transaction processing) traffic on every request, at a modest, spiky load. Recommended design: Direct VPC egress on the Cloud Run service pointed at the subnet where Cloud SQL's private IP lives, with the Cloud SQL instance itself reached via Private Service Connect rather than legacy private-services-access peering, so there's no standing connector to pay for and no shared peering range to manage. If this design later needs to reach the public internet from the same subnet via Cloud NAT (not just Cloud SQL over private IP), check for the cold-start delays Google's docs specifically describe for Direct VPC egress combined with Cloud NAT; that documented combination, not a generic assumption about high request volume, is the concrete signal to switch to a Serverless VPC Access connector with a pre-warmed minimum instance count instead, not a default starting point.
Trade-offs & pitfalls
The pitfall is picking the connector by default out of habit (it is the older, more familiar pattern) and paying for idle capacity nobody needed, or conversely defaulting to Direct VPC for an extremely latency-sensitive, high-throughput service without testing cold-start behavior under real load first. Mixing up Private Service Connect (reaching a specific managed service privately) with Serverless VPC Access or Direct VPC (reaching your own VPC generally) is a common source of over-engineered designs that stand up a connector and PSC and peering when only one was needed for the actual destination.
A SaaS vendor needs to structure networking for per-customer isolation. Compare Shared VPC with per-customer projects, separate VPCs per customer connected by peering, and fully separate organizations, on operational overhead, security isolation, and billing visibility.
Sample Answer
Direct answer
For per-customer isolation in a SaaS (Software as a Service) product, recommend Shared VPC (Virtual Private Cloud) with per-customer service projects as the default, reserving fully separate VPCs connected by peering, or fully separate organizations, for customers whose contracts specifically demand it (a regulated enterprise customer requiring provable network isolation, for instance). Shared VPC gives each customer's resources their own project boundary (which is where GCP's IAM, short for Identity and Access Management, quota, and billing granularity actually live) while keeping one network to secure, without the N-times operational and IP-planning cost of separate VPCs or the near-total duplication of separate organizations.
Structured elaboration
| Option | Operational overhead | Security isolation | Billing visibility |
|---|---|---|---|
| Shared VPC, per-customer service projects | Low: one host project, one IAM and firewall surface; new customer is a lightweight project-attach | Project-level: separate IAM, separate resource ownership, but customers still share the same network and firewall blast radius | Good: Cloud Billing already reports at project granularity, so per-customer cost is a native filter |
| Separate VPC per customer, connected by peering | Medium to high: N IP plans that must never overlap, N firewall rule sets, peering is non-transitive so cross-customer or shared-services connectivity gets mesh-shaped fast | Stronger: a compromise or misconfiguration in one customer's VPC cannot directly reach another's network layer | Good, same as above, plus network resources are also attributable per customer if labeled |
| Fully separate organizations | Highest: separate billing accounts, separate IAM hierarchies, separate everything to provision and support; onboarding a customer is closer to standing up a new company than adding a project | Strongest: no shared control plane at all between customers, which is the only option that satisfies some regulators' or auditors' literal reading of "isolated" | Cleanest possible: a dedicated billing account per customer, but now finance is reconciling N accounts instead of one filtered report |
Worked example
A mid-market SaaS company with 200 customers, three of them regulated financial institutions with contractual network-isolation clauses. The default path: one Shared VPC host project, and each customer gets a service project (cust-acme, cust-widgetco, ...) attached to it, with per-customer IAM and, if the product has per-customer compute, per-customer GKE (Google Kubernetes Engine) namespaces, a way to partition a single cluster so each customer's workloads stay logically separate, or Cloud Run services inside that project. The three regulated customers get the exception: each is given its own VPC, peered to a shared-services VPC that hosts common backend APIs, with their subnet's CIDR range (the block of IP addresses reserved for that network, such as 10.1.0.0/16) carved out of a reserved block up front so the peering never collides. Billing already tells the finance team what each customer costs, because both patterns keep costs inside a project boundary; only the fully-separate-org path would have required a second billing account per customer, which the company decided was not worth it for the 197 customers who never asked for it.
Trade-offs & pitfalls
The mistake to avoid is picking the strongest isolation model for everyone because one enterprise customer's security questionnaire mentions "network isolation": that answer, applied at scale, turns a 200-customer SaaS company into an operator of 200 separate networks or 200 separate organizations, most of which nobody is asking for and all of which now need to be kept patched, monitored, and audited independently. The right call is to offer the stronger tier as a paid or contractually gated option, sized to the handful of customers who actually need it, while the default tier (Shared VPC, per-customer project) carries the other 95+ percent at a fraction of the operational cost. The one thing every tier needs regardless is per-customer resource labeling from day one, because billing visibility and any future audit both depend on it, and it is far more expensive to retrofit labels onto years of existing resources than to require them at creation.
Unlock Full Question Bank
Get access to all 10 Google Cloud Platform Services and Architecture interview questions and detailed answers.
Sign in to ContinueJoin thousands of developers preparing for their dream job.