Google Cloud Platform interview questions

Reviewed by Mark Dickie · Last updated

Google Cloud Platform (GCP) is the public cloud service from Google, offering computing, storage, networking, machine-learning, and data-analytics products that run on the same infrastructure Google uses internally. For interview preparation, the areas that come up most often are compute options and when to pick each one, IAM roles and service accounts, VPC networking and firewall rules, managed storage and databases, and BigQuery for analytics. You should also be comfortable with cost controls (committed-use discounts, budgets, sustained-use billing being retired), and with the shared-responsibility model for security.

The table below maps the GCP service areas that interviewers tend to focus on:

Service areaCommon productsTypical interview angle
ComputeCompute Engine, GKE, Cloud Run, Cloud Functions, App EngineChoosing the right compute model for a workload; autoscaling trade-offs
Storage & databasesCloud Storage, Cloud SQL, Spanner, Firestore, BigtableMatching data shape and access pattern to the right store
AnalyticsBigQuery, Dataflow, Dataproc, Pub/SubPipeline design, partitioning, streaming vs. batch
NetworkingVPC, Cloud Load Balancing, Cloud CDN, Cloud DNSSubnet design, load-balancer selection, peering
Security & identityIAM, service accounts, Workload Identity, Secret ManagerLeast-privilege roles, key management, federation
OperationsCloud Monitoring, Cloud Logging, Cloud TraceObservability and incident response

What does a GCP interview typically test?

Most GCP interviews split into architecture and hands-on knowledge. The architecture portion asks you to design a system using GCP services — for example, a globally available web application, an ETL pipeline, or a cost-optimized batch-processing system. The hands-on portion checks whether you understand the specifics of individual services well enough to reason about them under pressure.

Core topics to study:

  1. Compute model selection — Know the differences between Compute Engine (IaaS), GKE (managed Kubernetes), Cloud Run (container-based serverless), and Cloud Functions (event-driven functions). Be able to justify a choice based on latency, cold-start tolerance, scaling requirements, and operational overhead.
  2. IAM fundamentals — Understand primitive vs. predefined roles, custom roles, service accounts, and Workload Identity Federation. Be ready to explain least-privilege design and how to avoid using the default compute service account.
  3. Storage decision tree — Cloud Storage for objects, Cloud SQL for relational with moderate scale, Spanner for globally consistent relational at scale, Firestore for serverless document storage, Bigtable for high-throughput NoSQL, and BigQuery for analytics. Interviewers want to hear the trade-offs, not memorized feature lists.
  4. Networking — VPCs are global in GCP, subnets are regional. Know the difference between global and regional load balancers, and when Cloud CDN is worth adding.
  5. Cost optimization — Committed-use discounts for steady workloads, right-sizing recommendations from Recommender, and lifecycle rules on Cloud Storage buckets to move objects to colder storage classes.

How should you prepare for a GCP system-design question?

Start by memorizing the GCP storage and compute decision trees cold, because those appear in nearly every architecture question. Then practice designing end-to-end systems: pick a scenario (a multi-region e-commerce site, a real-time fraud-detection pipeline, a healthcare data lake) and sketch which GCP services you would use at each layer, what your failure modes are, and where the bill grows fastest. If you can explain why you chose a service and what you would swap it for if requirements changed, you are in good shape for the interview.

The live quiz below tests these areas with real interview questions drawn from GCP-focused roles.

Key facts

  • Tarmac has 104 Google Cloud Platform interview questions on this topic, 25 of them on this page, at difficulty 1–5 of 5.
  • Tarmac tracked 786 job postings asking for Google Cloud Platform in August 2026.
  • Roles asking for Google Cloud Platform advertise a median base salary of £95,000, across 113 job postings as of August 2026.
  • Tarmac last reviewed these Google Cloud Platform interview questions on 31 August 2026.

At a glance

Questions25 shown · 104 in the bank
Difficulty1–5 of 5
FormatsMultiple answer, Fill in the blank, Short answer, Flashcard, Multiple choice, True / false, Code output, Find the bug, Ordering, Design exercise

What you'll review

  1. app engine
  2. cloud run
  3. cloud functions
  4. iam roles
  5. cloud monitoring
  6. bigquery
  7. committed use discounts
  8. firestore
  9. spanner
  10. workload identity
  11. pub sub
  12. cloud storage
  13. vpc
  14. load balancing

Practice questions

Try one before you open the answer. Pick an option and press Check; it's marked on the spot.

Google Cloud Platform/compute/app-engine

Which of the following statements correctly describe the App Engine Standard environment (second-generation runtimes, e.g., Python 3, Java 17)?#

Options

Pick every one that applies.

Show answer

The correct statements are that App Engine Standard can scale to zero with automatic scaling and min_instances: 0, runs in a sandbox restricting capabilities like local filesystem writes, and requires choosing from supported runtime versions. Custom runtimes via Dockerfile are a feature of App Engine Flexible, not Standard.

Why:

App Engine Standard (second-generation runtimes) runs in a sandbox that limits filesystem writes to /tmp and other capabilities (b). With automatic scaling and min_instances: 0 it scales to zero when idle (a), and you must choose from supported runtime versions in app.yaml (d). Custom runtimes via Dockerfile are a feature of App Engine Flexible, not Standard, so (c) is incorrect.

Google Cloud Platform/compute/cloud-run

Google Cloud Run is a managed compute platform that runs stateless containers and can automatically scale the number of serving instances down to _____ when there is no incoming traffic.#

Show answer

Google Cloud Run is a managed compute platform that runs stateless containers and can automatically scale the number of serving instances down to zero when there is no incoming traffic.

Why:

A hallmark feature of Cloud Run is scale-to-zero: when no requests are being served, the platform reduces the instance count to zero so you incur no compute charges, then spins instances back up on the next incoming request (subject to a configurable minimum instance count if set).

Google Cloud Platform/compute/cloud-functions

In Google Cloud Functions, what is the maximum execution duration (timeout) you can configure for a single function invocation? Give the value in minutes.#

Show answer

60 minutes (5400 seconds)

Why:

Google Cloud Functions allows you to set a timeout value up to 60 minutes (5400 seconds) for a single function execution. The default timeout is 1 minute (60 seconds), but it can be increased up to the 60-minute maximum in the function configuration.

Google Cloud Platform/iam-security/iam-roles

What are the three kinds of GCP IAM roles, and when should you reach for each?#

Show answer

GCP IAM has three role types. (1) Basic (a.k.a. primitive) roles — Owner, Editor, Viewer — are coarse, project-wide grants that predate fine-grained IAM. They are convenient but over-broad (Editor can change almost anything; Owner can also manage IAM), so they are discouraged for anything beyond small sandboxes or initial setup. (2) Predefined roles are service-specific, Google-curated bundles of permissions that follow least privilege — e.g. roles/storage.objectViewer, roles/bigquery.dataEditor, roles/pubsub.subscriber. These are the default choice: pick the narrowest predefined role that covers the task. (3) Custom roles are sets of individual permissions you assemble yourself when no predefined role fits the need precisely; they give the tightest least-privilege control but carry maintenance cost — you must update them as services add or rename permissions. Rule of thumb: avoid basic roles in production, prefer the narrowest predefined role, and create a custom role only when predefined roles are too broad or don't exist for the exact permission set you need.

Why:

This is a foundational IAM distinction interviewers expect cleanly. Basic/primitive roles (Owner/Editor/Viewer) are legacy, coarse, project-wide grants — easy but over-privileged, so avoid them in production. Predefined roles are Google-maintained, service-scoped least-privilege bundles (e.g. storage.objectViewer) and should be the default. Custom roles are hand-assembled permission sets for when predefined roles don't fit precisely — maximal least privilege at the cost of ongoing maintenance as permissions evolve. The signal of real understanding is the decision rule: predefined first, custom only when necessary, basic roles essentially never for production access.

Google Cloud Platform/operations/cloud-monitoring

In the Google Cloud operations suite (formerly Stackdriver), the service that collects metrics, dashboards, and alerting policies is Cloud _____, while the service that ingests, stores, and lets you query log entries is Cloud _____.#

Show answer

In the Google Cloud operations suite (formerly Stackdriver), the service that collects metrics, dashboards, and alerting policies is Cloud Monitoring, while the service that ingests, stores, and lets you query log entries is Cloud Logging.

Why:

The Google Cloud operations suite splits observability into distinct services. Cloud Monitoring handles time-series metrics, dashboards, uptime checks, and alerting policies (with notification channels) — it answers 'is the system healthy and within thresholds?'. Cloud Logging ingests, stores, and indexes structured and unstructured log entries from GCP services and your apps, with the Logs Explorer for querying and log-based metrics/sinks for routing logs to BigQuery, Cloud Storage, or Pub/Sub. The pairing matters in interviews because the legacy umbrella name 'Stackdriver' has been retired; using the current names (Cloud Monitoring, Cloud Logging, plus Cloud Trace and Error Reporting) signals you know the modern suite. A common follow-up is that you can create log-based metrics in Logging and then alert on them in Monitoring — the two services interlock.

Google Cloud Platform/compute/app-engine

Which of the following scaling modes are available for App Engine services?#

Options

Pick every one that applies.

Show answer

App Engine supports three scaling modes: automatic scaling (instances scale with traffic and latency targets), manual scaling (fixed instance count), and basic scaling (on-demand instances that shut down when idle). Predictive scaling is not a recognized App Engine scaling mode.

Why:

App Engine supports three scaling modes: automatic scaling (creates/deletes instances based on request volume and latency targets), manual scaling (a fixed number of instances always running), and basic scaling (instances are created on demand but shut down after idle, similar to a request-driven model). 'Predictive scaling' is not a named App Engine scaling mode, so (d) is incorrect.

Google Cloud Platform/compute/cloud-functions

In Google Cloud Platform, what serverless compute service runs single-purpose functions in response to events (such as HTTP requests, Pub/Sub messages, or Cloud Storage changes) without requiring you to provision or manage any servers?#

Show answer

The primary, autoscaling compute abstraction is Google Cloud Functions—a serverless, event-driven execution environment where Google automatically provisions and scales compute resources in response to HTTP requests or cloud events, so you deploy code without managing servers or clusters.

Why:

Cloud Functions is GCP's event-driven serverless offering: you write a function, attach a trigger, and Google handles scaling and infrastructure. This is distinct from Cloud Run (container-based) and App Engine (application-platform-based).

Google Cloud Platform/compute/cloud-functions

What are the two generations of Google Cloud Functions runtimes, and what underlying technologies does the newer generation leverage to provide improved performance, concurrency, and event handling?#

Show answer

The two supported runtime generations are 1st generation (Gen 1) and 2nd generation (Gen 2). Gen 2 is built on top of Cloud Run and Eventarc, offering enhanced performance, longer request timeouts (up to 60 minutes), larger instance sizes, up to 1,000 concurrent requests per instance, and broader event-source support compared to Gen 1.

Why:

Cloud Functions Gen 2 is powered by Cloud Run and Eventarc, delivering better concurrency (up to 1,000 vs Gen 1's 1), longer timeouts, and richer event sourcing. Gen 1 remains available for backward compatibility but Gen 2 is the recommended path for new workloads.

Google Cloud Platform/compute/cloud-run

Your team has a containerized HTTP API that should scale to zero when idle, autoscale on request volume, and require no cluster to manage. Among Cloud Run, Cloud Functions, and GKE, which is the best fit and why?#

Options

Show answer

Cloud Run is the best fit. It runs any container image, autoscales on request concurrency, scales down to zero when idle, and is fully managed with no node pool or control plane to operate. GKE can autoscale but is a full Kubernetes cluster — more operational surface than a single HTTP API needs, and standard node pools do not scale to zero. Cloud Functions is event/function-shaped rather than container-native. Pick the lightest service that satisfies the workload: container + request-driven + no ops points to Cloud Run.

Why:

Cloud Run is the managed serverless container platform: you hand it a container image and it autoscales the number of instances with incoming request concurrency, including down to zero when there is no traffic, with no cluster, node pool, or control plane to manage. That matches every requirement here. GKE (b) can autoscale and now offers Autopilot, but it is a managed Kubernetes cluster — heavier operational surface than needed for a single HTTP API, and standard GKE node pools do not scale to zero the way Cloud Run does. Cloud Functions (c) is event/function-oriented; while 2nd-gen Functions runs on Cloud Run infrastructure, the claim that it is the only option that can run a container is false — Cloud Run is the container-native service. Option d is wrong on a key fact: scaling to zero is a defining Cloud Run feature. The interview signal is matching workload shape to the lightest service that satisfies it: container + request-driven + no ops → Cloud Run.

Google Cloud Platform/data-analytics/bigquery

BigQuery is described as separating storage from compute. What does that architecture actually give you?#

Options

Show answer

BigQuery's split of storage from compute means storage and query compute scale and bill independently. Table data lives at rest in Google's distributed storage with no running cluster behind it, and a query allocates compute as slots on demand, then releases them. You never pre-size a fixed cluster to hold the data, and storage capacity is not capped by how much compute you buy. This is the opposite of a traditional MPP warehouse where data sits on always-on compute-node disks. The payoff is no idle cluster cost and elastic query compute.

Why:

BigQuery keeps table data in Google's distributed storage (Colossus), physically decoupled from the compute layer that executes queries. Compute is provided as slots — units of CPU/RAM that the Dremel engine allocates per query (on-demand pricing) or from a reservation. Because the two are decoupled, you scale and pay for them independently: petabytes can sit in storage at rest with no running cluster, and a query momentarily marshals as much parallel compute as it needs, then releases it. That is exactly the opposite of a traditional MPP warehouse where storage capacity is tied to the size of an always-on cluster (c) and data must live on compute-node local disk (b). Option d is wrong — the same tables are queried by the same engine; there is no API split. This separation is why BigQuery has no idle cluster cost and scales query compute elastically, a frequent interview talking point.

Google Cloud Platform/cost-billing/committed-use-discounts

On Compute Engine, sustained-use discounts are applied automatically the longer an instance runs in a month, whereas committed-use discounts (CUDs) require you to commit upfront to a 1- or 3-year term in exchange for a deeper discount.#

Options

Show answer

True. Sustained-use discounts are automatic and commitment-free: the longer an eligible Compute Engine VM runs within a billing month, the larger the discount Google applies to that usage, with nothing to opt into. Committed-use discounts are the opposite trade — you commit upfront to a 1- or 3-year term for a steady amount of resources or spend, and in return get a deeper discount, but you pay for the commitment whether you use it or not. SUDs reward unplanned steady usage at no risk; CUDs reward a predictable baseline with a bigger discount and a contractual obligation.

Why:

True. These are two distinct Compute Engine pricing mechanisms. Sustained-use discounts (SUDs) are automatic and require no commitment: as an eligible VM (or vCPU/memory usage in aggregate) runs for a larger fraction of the billing month, Google applies an increasing discount to that usage with nothing to opt into. Committed-use discounts are the opposite trade — you commit upfront to a steady amount of resources (or spend) for a 1-year or 3-year term and receive a substantially deeper discount in return, with the obligation to pay for the commitment whether or not you use it. The interview framing is the trade-off: SUDs reward unplanned steady usage with no risk; CUDs reward predictable baseline usage with a larger discount but a contractual commitment. They can also stack with other pricing such as Spot VMs only in limited ways, and CUDs are the right lever for a known steady-state baseline.

Google Cloud Platform/compute/cloud-run

A Cloud Run service api currently serves 100% of traffic from revision api-001. You run the command below. Immediately after it succeeds, where does live traffic go?#

gcloud run deploy api \
  --image gcr.io/proj/api:v2 \
  --no-traffic

Options

Show answer
A new revision is created from the v2 image but receives 0% of traffic; 100% still flows to api-001 until you explicitly shift traffic
Why:

Cloud Run is revision-based: each deploy creates a new immutable revision, and a separate traffic-allocation layer decides what percentage each revision serves. By default a deploy routes 100% of traffic to the new revision, but the --no-traffic flag overrides that: the v2 revision is created and ready, yet receives 0% of traffic while the previous revision (api-001) keeps serving 100%. This is the building block for safe rollouts — you deploy without exposure, smoke-test the new revision via its revision-specific URL, then gradually migrate traffic (gcloud run services update-traffic api --to-revisions api-00002=10) for a canary, or flip 100% when confident. Option b describes a default deploy without the flag. Option c is wrong — --no-traffic is a supported, common deploy flag. Option d is wrong — Cloud Run never auto-splits; traffic stays where it was until you change it. The interview point is understanding the revision/traffic split that makes blue-green and canary releases first-class on Cloud Run.

Google Cloud Platform/storage-databases/firestore

When would you choose Firestore over Cloud SQL for an application's primary datastore, and what does each give up in that trade?#

Show answer

Firestore is a serverless, horizontally-scaling NoSQL document database; Cloud SQL is managed relational (MySQL/PostgreSQL/SQL Server). Choose Firestore when you want automatic scaling with no instance to size, a flexible/evolving schema of documents and collections, real-time listeners and offline sync for mobile/web clients, and an access pattern dominated by key/document lookups. You give up rich relational features: multi-table SQL joins, complex ad-hoc queries and aggregations, and strong normalized-schema constraints — Firestore queries must be backed by indexes and avoid cross-collection joins, so you denormalize. Choose Cloud SQL when you need relational integrity, joins, transactions across many tables, complex reporting/analytics queries, or you are running an existing app that expects SQL. The trade there is operational and scaling: you size and manage an instance (CPU/RAM/disk), vertical scaling has a ceiling, and read scale-out means replicas rather than transparent horizontal scaling. Rule of thumb: document/real-time/elastic and lookup-shaped data fits Firestore; relational, join-heavy, transactional data fits Cloud SQL.

Why:

This probes data-model fit. Firestore is a serverless, auto-scaling NoSQL document store with real-time listeners and offline sync — ideal for mobile/web apps, flexible evolving schemas, and lookup-dominated access patterns, with no instance to provision. Its cost is relational power: no multi-table joins, limited ad-hoc/aggregate querying (every query needs an index), so you denormalize and model around access patterns. Cloud SQL is managed relational (Postgres/MySQL/SQL Server): joins, multi-table transactions, constraints, and rich SQL reporting, at the cost of running and sizing an instance, a vertical-scaling ceiling, and scale-out via read replicas rather than transparent horizontal scaling. A strong answer names the NoSQL-document vs relational distinction, ties the choice to access patterns (lookup/real-time vs join/transactional), and states what each gives up.

Google Cloud Platform/storage-databases/spanner

Cloud Spanner offers externally-consistent, strongly-consistent transactions across globally-distributed replicas. Which mechanism makes this possible?#

Options

Show answer

TrueTime makes it possible. It is a global clock built on GPS and atomic clocks that returns time as a tightly-bounded interval with known uncertainty. Spanner assigns each transaction a commit timestamp and waits out that uncertainty window before acknowledging, guaranteeing that a transaction starting after another commits gets a later timestamp. This delivers external, linearizable consistency across regions without routing every write through one coordinator and without eventual-consistency conflict resolution. It is why Spanner can offer relational, strongly-consistent SQL that still scales horizontally.

Why:

Spanner's external consistency rests on TrueTime, an API backed by GPS receivers and atomic clocks in every datacenter that returns time as an interval [earliest, latest] with a tightly bounded uncertainty. Spanner uses this to assign each transaction a globally-meaningful commit timestamp and applies a 'commit wait' — pausing briefly until the uncertainty interval has passed — so that any transaction that begins after another commits is guaranteed a later timestamp. That yields external (linearizable) consistency across continents without funneling all writes through one machine (b) and without eventual-consistency conflict resolution (c). It is a property of the storage system, not something the client implements with vector clocks (d). The takeaway interviewers probe: Spanner gives relational, strongly-consistent, horizontally-scalable SQL precisely because TrueTime solves global ordering — the trade is cost and the need to design schemas/keys to avoid hotspots.

Google Cloud Platform/iam-security/workload-identity

Why is Workload Identity (Federation, and on GKE) preferred over downloading and distributing service-account JSON keys? Select all that apply.#

Options

Pick every one that applies.

Show answer

Service-account JSON keys are long-lived static secrets that stay valid until revoked, so a leaked or committed key is a standing breach. Workload Identity replaces them with short-lived tokens exchanged at runtime. On GKE it binds a Kubernetes service account to a Google service account, so pods get scoped credentials with no key mounted. Workload Identity Federation does the same for workloads outside GCP — AWS, on-prem, or CI exchange their own identity for a GCP token with no exported key. It changes how a workload authenticates, not what it is authorized to do, so you still grant least-privilege roles.

Why:

Service-account JSON keys are long-lived, static secrets: once created they are valid until manually revoked, and a leaked or committed key is a standing breach. Workload Identity removes them. On GKE, Workload Identity binds a Kubernetes service account to a Google service account so pods receive short-lived, automatically-rotated credentials with no key file mounted (a, b). Workload Identity Federation extends the same idea to workloads outside GCP — an AWS role, an on-prem OIDC identity, or a CI provider like GitHub Actions exchanges its native token for a short-lived GCP access token, again with no exported GCP key (c). Both deliver the security win in (a): no static key to leak. Option d is dangerously wrong — Workload Identity changes how a workload authenticates, not what it is authorized to do; you still grant least-privilege IAM roles to the impersonated service account. Option e is nonsense. The interview point: prefer federated/short-lived credentials and treat downloaded SA keys as a last resort.

Google Cloud Platform/data-analytics/bigquery

events is partitioned by DAY on the event_date column and holds 365 daily partitions of roughly equal size. On-demand BigQuery bills by bytes scanned. Roughly how much data does this query scan relative to a full-table scan?#

SELECT user_id, COUNT(*) AS n
FROM `proj.ds.events`
WHERE event_date BETWEEN '2024-01-01' AND '2024-01-07'
GROUP BY user_id

Options

Show answer
About 7/365 of the table — the filter on the partition column prunes to 7 daily partitions, so only those bytes are scanned and billed
Why:

Because the table is partitioned on event_date and the predicate filters directly on that partition column with constant bounds, BigQuery prunes the scan to just the matching partitions. The range covers 7 days, so it reads roughly 7 of the 365 daily partitions — about 7/365 of the data — and on-demand pricing bills only those bytes. This is the central reason to partition large tables: a query that touches a small date window pays for a small fraction of the table. Option b is wrong — partition pruning is precisely about reducing bytes scanned (the billed dimension), not storage. Option c is wrong; the aggregation still scans the pruned partitions' data, it is not free metadata. Option d undercounts — a 7-day BETWEEN matches 7 partitions, not 1. A common trap that defeats pruning is wrapping the partition column in a function (e.g. DATE(timestamp_col) when not partitioned on that expression) or comparing it to a non-constant, which forces a full scan; clustering further reduces bytes within a partition.

Google Cloud Platform/data-analytics/pub-sub

A Pub/Sub subscriber pulls a message, processes it successfully, but crashes before calling ack() — and the ack deadline then expires. What does Pub/Sub do next?#

msg = subscriber.pull()
process(msg)        # succeeds, side effects applied
# process crashes here, before ack()
# ack deadline expires...

Options

Show answer
Pub/Sub redelivers the message (default subscriptions are at-least-once), so it will be processed again — subscribers must be idempotent to tolerate duplicates
Why:

Standard Pub/Sub subscriptions are at-least-once: a message is held as outstanding until the subscriber acknowledges it within the ack deadline. If the deadline expires without an ack — which is exactly what happens when the subscriber crashes before ack() — Pub/Sub assumes delivery failed and redelivers the message. Crucially, that redelivery happens even though the side effects of process() already ran, because Pub/Sub cannot know the work succeeded; it only saw the missing ack. The consequence engineers must design for: subscribers should be idempotent (dedupe on a message id or use idempotent writes) so a duplicate delivery does not double-apply effects. Option b inverts the model (an expired deadline is the trigger for redelivery, never an implicit ack). Option c is wrong for the default — exactly-once delivery is an opt-in subscription feature with constraints, not the default everywhere. Option d is wrong — dead-lettering only kicks in after the configured max delivery attempts, not the first miss. The classic interview line: 'Pub/Sub is at-least-once, so make consumers idempotent.'

Google Cloud Platform/storage-databases/cloud-storage

This Terraform is meant to let only the application's service account read objects in a private Cloud Storage bucket. A security scan flags the bucket as world-readable. What is the bug?#

resource "google_storage_bucket" "data" {
  name     = "acme-private-data"
  location = "US"
}

resource "google_storage_bucket_iam_member" "reader" {
  bucket = google_storage_bucket.data.name
  role   = "roles/storage.objectViewer"
  member = "allUsers"
}

Options

Show answer

The member is allUsers, which grants read to anyone on the internet — it should be serviceAccount:[email protected] for the app's identity only

Why:

allUsers is a special IAM identifier meaning everyone on the internet, authenticated or not. Binding roles/storage.objectViewer to allUsers makes every object in the bucket publicly readable — precisely what the scanner caught — even though the intent was to grant access to one service account. The fix is to set member = "serviceAccount:[email protected]" so only the application's identity can read. Option b is wrong and dangerous: roles/storage.objectViewer is exactly the right least-privilege role for reading objects; roles/owner would massively over-grant. Option c is false — location is set and has nothing to do with access control. Option d is false — google_storage_bucket_iam_member is the correct, recommended way to grant a role to a member (IAM, not legacy ACLs). The general lesson interviewers want: allUsers/allAuthenticatedUsers are public-access grants — never use them for private data, and prefer per-identity service-account bindings with the narrowest role.

Google Cloud Platform/networking/vpc

In GCP networking, a VPC network is a global resource while subnets are regional. Explain what that means and one practical consequence for designing a multi-region deployment.#

Show answer

A GCP VPC network is global: a single VPC spans every region without needing VPNs or peering to connect regions, and it provides one routing domain and one firewall-rule namespace across the whole network. Subnets, by contrast, are regional: each subnet lives in one region and owns an IP range (CIDR) used by resources in that region. The practical consequence is that you can run resources in us-central1 and europe-west1 inside the same VPC, give each region its own regional subnet/CIDR, and they communicate over Google's private backbone using internal IPs with no inter-region VPN — firewall rules and routes defined at the VPC level apply globally. This simplifies multi-region architecture: one VPC, per-region subnets, internal connectivity by default. A related consequence is IP planning — because subnets are regional and own non-overlapping ranges, you allocate distinct CIDR blocks per region up front to avoid conflicts and leave room to grow. (Some load balancers and managed services are global too, which pairs naturally with the global VPC.)

Why:

The key fact: in GCP the VPC network itself is a global object, but subnets are scoped to a single region. So one VPC can hold resources across many regions, with a global routing domain and global firewall-rule/route namespace, and inter-region traffic flows over Google's private backbone on internal IPs — no VPN or peering needed just to cross regions. Each subnet is regional and owns a CIDR for its region. The practical consequences worth naming: (1) multi-region deployments are simple — one VPC, a regional subnet per region, internal connectivity by default; (2) IP planning matters — allocate non-overlapping CIDR ranges per region with headroom. This differs from clouds where the VPC is regional and cross-region requires peering. A strong answer states global-VPC/regional-subnet, the no-VPN internal connectivity consequence, and ideally the CIDR-planning point.

Google Cloud Platform/networking/load-balancing

A user request hits a global external Application Load Balancer fronting a Cloud Run / instance-group backend. Order the load-balancing components the request flows through, from the edge inward.#

Put these in order

Show answer

The request flows edge-inward through the load balancer's chained components. First the global anycast IP and forwarding rule draw the user to the nearest Google edge POP. The forwarding rule hands off to a target HTTP(S) proxy, which terminates the connection and TLS. The proxy consults the URL map, which matches host and path to choose a backend service. The backend service applies its load-balancing policy and health checks to select a healthy backend. Finally the backend — a serverless NEG for Cloud Run or a managed instance group — serves the request.

Why:

A global external Application Load Balancer is assembled from chained components, and a request traverses them edge-inward. (1) The forwarding rule's global anycast IP draws the user to the closest Google edge point of presence. (2) The forwarding rule hands off to a target HTTP(S) proxy, which terminates the client connection (and TLS, when configured). (3) The proxy consults the URL map, which matches the request's host and path against rules to select a backend service (this is where host/path-based routing and redirects live). (4) The chosen backend service applies its load-balancing policy, session affinity, and health checks to pick a healthy backend. (5) The request finally reaches a backend — a network endpoint group (e.g. a serverless NEG for Cloud Run) or a managed instance group — which serves it. Knowing this chain (forwarding rule → target proxy → URL map → backend service → backend/NEG) is what lets you reason about where TLS terminates, where routing decisions happen, and where to attach health checks.

Google Cloud Platform/compute/app-engine

In Google App Engine Flexible environment, automatic scaling can be configured with min_num_instances set to 0, allowing the application to scale to zero instances when there is no incoming traffic, just as App Engine Standard can.#

Options

Show answer

False. App Engine Flexible cannot scale to zero instances — the minimum allowed value for min_num_instances is 1. This is because Flexible runs on Compute Engine VMs that are costlier and slower to start than Standard's lightweight instances, so the platform always keeps at least one VM alive. App Engine Standard, by contrast, supports min_instances: 0 and can fully scale to zero when idle.

Why:

App Engine Flexible does not support scaling to zero instances. The minimum value for min_num_instances in an automatic scaling configuration for the Flexible environment is 1. This is because Flexible environment instances are backed by Compute Engine VMs that take longer to provision than Standard environment instances, and the platform keeps at least one instance running at all times. App Engine Standard, by contrast, can set min_instances to 0 and scale to zero when idle.

Google Cloud Platform/compute/app-engine

In Google App Engine, the Cron Service sets the X-Appengine-Cron HTTP header on requests it initiates, and App Engine automatically strips this header from requests originating from external users, so a request handler can trust the presence of this header as proof that the request was triggered by the Cron Service.#

Options

Show answer

True. App Engine's Cron Service sets the X-Appengine-Cron header internally, and the platform strips X-Appengine-* headers from external requests before they reach your handler. A handler that sees this header can trust the request came from the Cron Service. Google still recommends adding a secret token in the cron URL as defense-in-depth, but the header alone is a reliable signal.

Why:

The X-Appengine-Cron header is set internally by the App Engine Cron Service. App Engine's infrastructure strips X-Appengine-* headers from external requests before they reach the application, so an outside user cannot inject this header. Therefore, if a handler observes X-Appengine-Cron: true, it can reliably conclude the request was initiated by the Cron Service. Google's documentation explicitly states that the handler can trust this header for cron authentication, though adding an additional shared secret in the cron URL is still a recommended defense-in-depth practice.

Google Cloud Platform/compute/cloud-functions

A 2nd gen HTTP-triggered Cloud Function written in Node.js has been scaled to zero by Cloud Run. A new HTTPS request arrives, triggering a cold start. Place the following steps in the strict order they occur during this cold-start invocation.#

Put these in order

Show answer

The correct order is: Cloud Run provisions a new container instance → the Node.js process and Functions Framework initialize → module-scope global code executes → the exported entry point function is invoked with the request → the HTTP response is returned. Global code runs during module load, which happens once per instance, before any individual request handler is called.

Why:

A 2nd gen Cloud Function is backed by a Cloud Run service. On a cold start, Cloud Run first provisions a new container instance (a). The container's entrypoint launches the Node.js process and the Functions Framework begins initialization (b). When the framework loads the user's module via require/import, all module-scope code runs at that point (c) — this is why initializing expensive clients (Firestore, etc.) at module scope is recommended, as it runs once per instance rather than per invocation. Only after the module is loaded does the framework resolve the exported entry point; it then invokes that function with the incoming request (d). Finally, the handler completes and the response is sent back to the caller (e).

Google Cloud Platform/compute/cloud-run

You are designing a document-rendering platform on Google Cloud Run. Customers upload large PowerPoint, Word, and CAD files (up to 2 GB) through a web UI; the system must render each file to a set of PNG thumbnails and a PDF, then notify the customer. Expected peak load: 5,000 concurrent render jobs. SLA: P95 end-to-end latency from upload to notification ≤ 4 minutes for files ≤ 50 MB, and ≤ 30 minutes for files up to 2 GB. Cost is a primary concern — the finance team has flagged that idle compute cost must be near zero outside business hours. Hard constraints: (1) No GKE; the team is small and wants serverless. (2) Render binaries are Linux x86_64 container images, each 4–8 GB. (3) Some render engines are CPU-bound, some are memory-bound, and one legacy engine occasionally crashes and must be isolated so it cannot affect other renders. (4) Files must never be stored unencrypted at rest or in transit. (5) The platform must survive a full regional outage with RTO ≤ 15 minutes and RPO ≤ 5 minutes.#

Show answer

Architecture Overview

Upload and Orchestration Layer (Cloud Run Services)

A Cloud Run service in each region serves as the API gateway. It accepts the upload via a signed-URL flow: the client requests an upload URL from the service, which generates a Cloud Storage signed URL with a short TTL, and the client uploads directly to a regional Cloud Storage bucket. This avoids streaming 2 GB through the Cloud Run container. The service then enqueues a render task onto Pub/Sub (or Cloud Tasks for per-task rate limiting) and returns immediately to the client with a job ID. A WebSocket or long-poll endpoint (or Firebase Realtime Database / Firestore listener) lets the client track progress.

Render Layer (Cloud Run Jobs)

The actual rendering is performed by Cloud Run jobs, not services. Rationale: render workloads are batch processes with no HTTP listener, can run longer than the service request timeout, and benefit from job-level retries and parallelism. Each render engine type gets its own job template:

  • CPU-bound engine (e.g., CAD renderer): --concurrency is not applicable to jobs; instead, run one task per job execution, set CPU allocation to the maximum (e.g., 8 vCPU), memory to a modest 4 GiB, and set --task-timeout to a value below the SLA ceiling (e.g., 25 min for the 30-min SLA tier).
  • Memory-bound engine (e.g., large PowerPoint with embedded media): Set memory to 16–32 GiB with 2–4 vCPU, and cap --parallelism so that concurrent tasks do not exceed available memory on the underlying node.
  • Legacy crash-prone engine: Isolated in its own Cloud Run job with its own revision, a tight --task-timeout (e.g., 5 min), --max-retries=3, and a separate service account with minimal IAM scope. A wrapper script inside the container captures exit codes and writes a structured failure event to Pub/Sub. Because it is a separate job, a crash or OOM cannot consume the quota or instances of the healthy engines.

Large Image and Cold-Start Strategy

The 4–8 GB render-engine images are the biggest cold-start risk. Strategy:

  1. Multi-stage Docker builds strip build tooling and debug symbols, targeting a distroless or Alpine base where the engine allows it. This can often cut image size by 40–60%.
  2. Separate runtime data from the image: Ship only the engine binary in the image; download fonts, templates, and reference data from Cloud Storage at startup (mounted via Cloud Storage FUSE) or bundle them in a smaller companion layer.
  3. Warmup during business hours: Set --min-instances on the API gateway service to 1 (or 2 for HA) during 06:00–20:00 local time via a scheduled Cloud Workflow that updates the service config, and drop to 0 outside business hours. For jobs, cold starts are less latency-sensitive (the client is async-waiting), but we can pre-trigger a no-op warmup job every 15 minutes during peak hours to keep the container layer cache warm on at least one node.
  4. If image size remains problematic, split the monolithic image into a base image (engine binary, ~2 GB) stored in Artifact Registry with a regional replica in each deployment region, and a thin per-revision config layer.

Concurrency, Autoscaling, and Cost

  • Cloud Run services (API gateway): --concurrency=80 (default), --min-instances=0 off-hours, --min-instances=2 peak hours for low-latency API responses. --max-instances capped per region to control blast radius.
  • Cloud Run jobs: scale via --parallelism and --task-count. A Cloud Scheduler + Cloud Workflows orchestration submits batch job executions every minute, pulling available tasks from a Firestore-backed queue. When the queue is empty, no job is submitted — idle cost is zero.
  • Use Cloud Run CPU allocation = always-on CPU only for jobs that need background processing within the container; for the API gateway, CPU is only billed during request handling (request-based CPU), which is cheaper for spiky traffic.
  • Committed Use Discounts on the memory and vCPU for the predictable business-hours baseline, and scale-to-zero for everything else.

Multi-Region DR Design

Active-passive with warm standby in a second region. Rationale: active-active for render workloads doubles storage and compute cost and introduces cross-region job-deduplication complexity. Instead:

  • Primary region (e.g., us-central1): API gateway, Pub/Sub, Cloud Storage primary bucket, Cloud Run jobs.
  • Secondary region (e.g., europe-west1): API gateway deployed but scaled to --min-instances=0; Pub/Sub subscription with a dead-letter topic replicated; Cloud Storage bucket with turbo replication (or a CMEK-encrypted dual-region bucket) so RPO ≤ 5 min.
  • Traffic failover: An external HTTP(S) Load Balancer with serverless NEGs to both regional Cloud Run services. Health checks probe the API gateway; on failure, the LB routes to the secondary. DNS is not needed for failover — the LB handles it in seconds, meeting RTO ≤ 15 min.
  • In-flight job recovery: When a job fails or the region goes down, the Pub/Sub message is not acknowledged (or the Cloud Task retries). The secondary region's job execution picks up the same Pub/Sub subscription (or a replica), re-renders, and writes results to the secondary bucket. Idempotent job IDs prevent double-notification: the worker checks Firestore for a completion record before rendering.

Encryption Design

  • In transit: All traffic uses TLS 1.2+ (Cloud Run enforces HTTPS). Signed URLs for Cloud Storage uploads/downloads use HTTPS. Inter-service calls use Google-managed mTLS via VPC connector or private services.
  • At rest: CMEK (Customer-Managed Encryption Keys) via Cloud KMS on all Cloud Storage buckets, Artifact Registry, and Cloud Run revisions. Keys are rotated every 90 days. For the most sensitive customer data, CSEK (Customer-Supplied Encryption Keys) can be used on the upload bucket so even Google cannot read the raw files.
  • Key replication: KMS key rings are deployed in both regions with the same key material (imported via EKM or replicated key rings) so the secondary region can decrypt objects without a cross-region KMS call.
Why:

This is a staff-level design exercise: it requires deep knowledge of Cloud Run services vs jobs, container image optimization for cold starts, concurrency/resource tuning per workload profile, multi-region failover with serverless NEGs and Pub/Sub re-queue, and CMEK/CSEK encryption — all under cost and SLA constraints.

Google Cloud Platform/compute/cloud-run

You are building a real-time fraud-detection pipeline on Google Cloud Run. A Pub/Sub topic ingests 50,000 events/second (payment transactions) from a global payments platform. Each event must be enriched with user history from a Cloud Spanner database, scored by an ML model served via Vertex AI Endpoints, and the result written back to a Pub/Sub topic for downstream action. Requirements: (1) P99 enrichment+scoring latency ≤ 200 ms per event. (2) At-least-once delivery is acceptable, but duplicate processing must be idempotent and the system must deduplicate within a 5-minute window. (3) If the Vertex AI endpoint latency degrades beyond 500 ms P99, the pipeline must shed load by falling back to a lightweight rules-based scorer and emit an alert — not crash or unboundedly queue. (4) The pipeline must handle poison messages (malformed/unscorable events) without blocking the subscription. (5) Cost must scale linearly with throughput and be zero when idle. (6) The system must be deployable across 3 regions with automatic failover.#

Show answer

Architecture Design

High-Level Flow

Pub/Sub (ingest topic) → Cloud Run (enrich+score service) → Pub/Sub (result topic)
                              ↓
                     Memorystore (Redis) — dedup
                              ↓
                     Cloud Spanner — user history
                              ↓
                     Vertex AI Endpoints — ML scoring

Cloud Run Service Configuration

  • Service, not job: Each event is a request-response cycle. Cloud Run services are the right abstraction.
  • Concurrency = 8: Each instance handles 8 concurrent requests. At 50k events/s, this yields ~6,250 concurrent requests. With each request taking ~150 ms (enrichment + scoring), we need ~6,250 × 0.15 = ~940 in-flight requests, which at concurrency 8 means ~118 instances. Set --max-instances=300 (with quota increase) to absorb bursts. Concurrency=1 would require ~6,250 instances — wasteful and quota-prohibitive. Concurrency=80 (default) would cause CPU contention on the Spanner/Vertex AI client threads, degrading P99.
  • CPU = always-allocated (--cpu-boost or --no-cpu-throttling): The service makes synchronous gRPC calls to Spanner and Vertex AI; CPU throttling during I/O wait would inflate latency beyond the 200 ms budget.
  • Memory = 1 GiB: The service is stateless aside from a small in-memory LRU cache (512 MB) for hot user IDs. Spanner results and Vertex AI responses are not buffered in memory.
  • Request timeout = 250 ms: Set above the 200 ms P99 SLA to allow tail events to complete, but low enough that Pub/Sub push retries quickly rather than hanging.
  • Min-instances = 0: Cost is zero when idle. Cold starts add ~2–5 s for the first request, but Pub/Sub push will retry, and the first batch of events will simply be delayed by one cold-start cycle — acceptable given the at-least-once model.

Pub/Sub Subscription Model

  • Push delivery to the Cloud Run service endpoint. Rationale: push delivery lets Pub/Sub manage flow control and backpressure automatically — if Cloud Run returns 429 or 503, Pub/Sub slows down. Pull would require a separate poller and adds latency.
  • Ack deadline = 30 s: Pub/Sub push waits for the HTTP response. A 200 means ack; a non-2xx or timeout means nack and redelivery. 30 s is generous enough for the 250 ms request timeout plus retries, but short enough that a failed region's messages are redelivered to another region within RTO.
  • Dead-letter topic: max_delivery_attempts=10. After 10 failed deliveries, the message moves to a DLQ topic. A separate Cloud Run service consumes the DLQ, writes the payload to BigQuery for analysis, and can replay via a Pub/Sub publish back to the ingest topic after fixing the root cause.

Deduplication Strategy

  • Primary: Memorystore (Redis) with SETNX + TTL. Each event carries a unique transaction_id. The worker does SET transaction_id NX EX 300 (5-minute TTL). If the key already exists, the event is a duplicate — skip scoring, but still publish the prior result (retrieved from a short-lived Redis result cache) to the result topic so downstream consumers are not blocked.
  • Fronting LRU cache: An in-process LRU cache (Caffeine / functools.lru_cache) with 10k entries and 60-second TTL catches the hottest duplicates without a Redis round-trip. This keeps dedup latency under 1 ms for the common case.
  • Fallback: If Redis is unavailable (connection error, failover), the worker falls back to a Spanner INSERT … ON CONFLICT DO NOTHING on a processed_events table keyed by transaction_id. This is slower (~5–10 ms) but correct. The circuit breaker for Redis (separate from the Vertex AI one) trips after 5 consecutive failures, switching all traffic to Spanner-based dedup.

Circuit Breaker and Vertex AI Fallback

  • Sliding-window latency tracker: Each worker instance maintains a ring buffer of the last 100 Vertex AI response latencies. If the P99 of this window exceeds 500 ms, the circuit opens.
  • Open state: The worker routes scoring to the rules-based fallback scorer (a lightweight in-process function using thresholds from Spanner user history: velocity, geo-distance, amount). The result is tagged score_engine=fallback so downstream consumers know the confidence level is lower. A Cloud Monitoring custom metric and alert fire immediately.
  • Half-open state: Every 30 seconds, the worker sends 1% of traffic to Vertex AI (probe requests). If 10 consecutive probes return under 200 ms, the circuit closes and full traffic resumes.
  • Budget enforcement: The fallback scorer runs in <5 ms, so the 200 ms P99 budget is easily met during degradation. The enrichment (Spanner lookup, ~10 ms) + fallback scoring (~5 ms) + dedup (~1 ms) + Pub/Sub publish (~5 ms) = ~21 ms total.
  • Shared circuit state across instances: The circuit state is also written to Redis (or a lightweight Cloud Spanner counter) so that when one instance detects degradation, all instances switch quickly rather than each independently discovering the problem. However, each instance can also trip locally to avoid a Redis dependency in the critical path.

Poison-Message Handling

  • Detection at ingress: The worker validates the event schema immediately upon deserialization. If the JSON is malformed, required fields are missing, or the transaction_id is absent, the worker publishes the raw event to the DLQ topic and returns HTTP 200 (ack) — this prevents Pub/Sub from endlessly redelivering the poison message.
  • Unscorable events: If the Vertex AI endpoint returns a structured error (e.g., feature vector out of range), the event is published to a quarantine topic (distinct from the DLQ) with the error reason. A human-in-the-loop review service consumes the quarantine topic.
  • Timeout = poison: If a single event causes three consecutive request timeouts (250 ms each), the worker publishes it to the DLQ and acks the original message. This prevents a pathological event from consuming retry budget indefinitely.

Multi-Region Failover

  • 3-region deployment: us-central1, europe-west1, asia-east1. Each region has its own Cloud Run service, Memorystore instance, and Spanner instance (Spanner is multi-region by nature — use a nam-eur-asia3 config for global consistency).
  • Pub/Sub topology: A single global ingest topic with regional push subscriptions — one push endpoint per region. Pub/Sub delivers messages to whichever region's subscription is healthiest. Use Cloud Pub/Sub message ordering with a partition key (user_id) to ensure ordering per user.
  • Traffic routing: An external HTTP(S) Load Balancer with serverless NEGs to each regional Cloud Run service. Health checks probe a /health endpoint that verifies Spanner, Redis, and Vertex AI connectivity. If a region fails health checks, the LB stops routing to it, and Pub/Sub push messages to that endpoint will fail and be redelivered to the other regions' subscriptions after the ack deadline (30 s) expires.
  • In-flight event safety: Because Pub/Sub operates with at-least-once and ack-deadline redelivery, events being processed in a failed region are not lost — they will be redelivered. The deduplication layer in the receiving region prevents double-processing. RTO = ack deadline + cold start ≈ 35 s, well within any reasonable target.
Why:

This is a staff-level design exercise requiring deep knowledge of Cloud Run concurrency tuning, Pub/Sub push vs pull with ack deadlines, Redis-based deduplication with Spanner fallback, circuit-breaker patterns for ML endpoint degradation, poison-message DLQ design, and multi-region active-active failover with Pub/Sub redelivery semantics. The corrected c1 criterion now asks for a request timeout set ABOVE the 200 ms P99 SLA (not below it), matching the reference answer's 250 ms choice and the sound reasoning that a timeout below the SLA would prematurely kill legitimate tail-latency requests.

Related interview questions

Job market

See gcp salaries and hiring demand from live job postings.

The other 79 questions

This page shows 25 and marks what you pick. That's as far as a page can go. A free account opens the other 79 and keeps every answer. What you miss comes back until it's right: after a day, then at longer gaps.

Start with this topic

Free · the whole bank · 100 marked answers per 30 days · written feedback on the paid plan

What moved, monthly

One email a month when the bulletin comes out: what moved in the markets we track, and the new question topics we published. Confirm your address to join. Unsubscribe any time.