Bite-sized, standalone interview questions and answers for Google Cloud. Read 5-10 per sitting. Each answer is 2-4 sentences max and stands on its own.

68 questions shown. Filter by keyword or difficulty below.

Topic: Application Default Credentials (Order 0)

ADC is a fixed, three-step fallback chain (env var, well-known gcloud file, metadata server) that resolves a credential once per process and caches it. It solves the problem of the same code needing to authenticate differently across a developer laptop, CI runner, and GCE/GKE/Cloud Run — without branching on environment.

gcloud auth login only authenticates the gcloud CLI itself. gcloud auth application-default login writes the application_default_credentials.json well-known file that DefaultCredentialProvider actually looks for in step 2 of the ADC chain. Confusing these two is a common mistake even in Google’s own doc comments.

ComputeCredential pings 169.254.169.254 up to 3 times with a 500ms timeout each. If all fail, it falls back to reading /sys/class/dmi/id/product_name (Linux) or Win32_BIOS Manufacturer (Windows) for the literal string “Google” — a local, network-free way to detect Google hardware.

WIF doesn’t bypass ADC — it feeds step 1. google-github-actions/auth writes a short-lived external-account config file and sets GOOGLE_APPLICATION_CREDENTIALS to point at it, so the same env-var branch in the fallback chain picks it up. WIF changes what ends up in that file, not how it gets discovered.

Pointing it at a downloaded JSON service account key that never expires. Long-lived exportable keys are actively discouraged; Workload Identity Federation (which writes a short-lived config to the same path) is the current recommendation for anything running on GCE/GKE/Cloud Run.

Each GetAdcFrom*Async method returns null when its source simply isn’t present, letting the ?? chain fall through cleanly. A source only throws when it is present but corrupt (e.g. the env var points to an unreadable file), deliberately distinguishing “not configured” from “misconfigured.”

Topic: Compute Engine vs App Engine vs Cloud Run (Order 1)

Cloud Run (built on Knative Serving) models “zero instances” as a first-class state with an activator component that intercepts requests and cold-starts an instance. Compute Engine VMs keep running regardless of traffic — they have no equivalent mechanism to stop when idle.

It controls whether the activator stays in the request path. Setting it to "0" means the activator only intercepts when there are exactly zero warm instances — specifically the scale-to-zero cold-start path, not a general-purpose traffic router.

When you need baseline pods running constantly (zero traffic doesn’t mean zero instances) and want Kubernetes-native features like DaemonSets, StatefulSets, or complex networking. Autopilot removes node management but the cluster and its pods are still running things — it doesn’t scale to zero like Cloud Run.

It bases scaling on concurrent in-flight requests per instance rather than a static replica count, which means latency can spike during cold starts from zero. Compute Engine’s fixed instance count has no cold-start latency but wastes resources at zero traffic.

The activator intercepts the request, triggers a cold start of a new instance, then routes the request in — the caller experiences added latency for that first request. This is the fundamental latency-vs-cost tradeoff of serverless scale-to-zero.

Topic: IAM (Order 2)

iam_member is additive — it grants one member a role without touching any existing members. iam_binding is authoritative for that role — it replaces the entire member list, silently dropping anyone not listed in the Terraform config, even principals granted access outside that run.

Every principal not listed in the binding’s members list loses that role on apply — silently, with no warning. The blast radius scales with how much the role could do, which is why authoritative mode on basic roles is particularly dangerous.

When you need to declare the complete, exclusive set of principals for a tightly-controlled role (e.g., a custom admin role where you want Terraform to be the single source of truth for membership). Authoritative mode is the correct tool for that job — it’s not inherently a bug.

Reaching for google_project_iam_binding (authoritative) when you meant to add one member alongside grants managed by other teams or automation. The resource names look similar, so the destructive one gets used accidentally — the production Terraform IAM module addresses this by surfacing the choice as an explicit mode variable.

IAM Conditions (title/description/expression) are identical regardless of binding mode. Choosing a binding mode and adding a least-privilege condition are two independent decisions — the condition block structure is shared across both resource types in the production module.

Topic: VPC Networking (Order 3)

IP-based rules are brittle — when instances are destroyed and recreated with different IPs, the rules become stale and either block correct traffic or allow traffic to wrong addresses. Identity-based targeting (network tags or service accounts) survives IP churn because it references who the instance is, not where it happens to be numerically.

A subnet’s primary range gives Node VMs their IPs, while separate secondary ranges carve out independent address spaces for Pod IPs and Service IPs (alias IP ranges). This lets thousands of ephemeral Pod IPs coexist cleanly with a much smaller, stable set of Node IPs on the same subnet.

The rule matches by tag, not IP. When a VM tagged web-frontend is destroyed and a new one with the same tag is created at a different IP, the rule still matches because it never referenced an IP — only the identity-level tag.

You miss the tag and service-account targeting mechanisms the platform offers, and you end up re-fighting the “instances keep changing IPs” problem that identity-based targeting exists specifically to solve. A real production rule set commonly mixes IP-range, tag, and service-account targeting in the same ruleset.

It controls whether instances without external IPs can reach Google APIs (Cloud Storage, BigQuery, etc.) over Google’s internal network rather than the public internet. It’s independent of both firewall rules and secondary IP ranges — a third axis of traffic configuration.

Topic: Cloud Storage (Order 4)

SetStorageClass transitions an object to a cheaper storage class (STANDARD → NEARLINE → COLDLINE), and Delete removes it. Cost-driven transitions are arguably the more common real-world use case — deletion is just one option.

It scopes a rule to only fire on objects currently in a specific storage class, enabling correct staged transitions — e.g., a rule that only moves objects from NEARLINE to COLDLINE won’t accidentally re-apply to objects already in COLDLINE or still in STANDARD.

age measures time since the object was uploaded. days_since_noncurrent_time measures time since a version stopped being current (was superseded by a newer version). A version could be years old but only recently become noncurrent — these target different lifecycle events.

Using num_newer_versions without understanding it only prunes noncurrent versions, not the current one. A rule with num_newer_versions = 3 keeps the 3 most recent versions and deletes older noncurrent ones — it never touches the live object, which is a materially different operation than blanket age-based deletion.

When the business-relevant age of an object isn’t when it was uploaded, but when it became relevant (e.g., a document’s retention period starts from when it was last reviewed, not when it was uploaded). You set custom_time on the object explicitly, and days_since_custom_time measures from that user-defined point.

Topic: Cloud SQL vs Spanner vs Firestore (Order 5)

TrueTime is a globally-synchronized clock with a bounded uncertainty interval, not just “a clock that’s close enough.” It lets Spanner assign real, externally-ordered timestamps to transactions without a global lock — the server, not the client, is the authority on what timestamp a staleness bound resolves to.

OfExactStaleness reads at a timestamp exactly duration old, chosen once near the start — useful for nearby replicas without distributed timestamp negotiation overhead. OfMaxStaleness reads at NOW - duration or newer, which requires more coordination to determine “now” precisely.

The read is still correct because the timestamp is chosen by Spanner’s server using TrueTime, not derived from the client’s clock. A client with a badly skewed local clock still gets correct, bounded results for staleness reads.

Strong reads the absolute latest committed data but may cross regions to confirm, adding latency. OfMaxStaleness reads from a nearby replica with lower latency but guarantees data is no older than the specified duration. The choice is per query, not fixed for the database.

Treating it as just a scale decision (“Spanner for bigger workloads”) when the real difference is architectural. Spanner’s value — horizontal write scalability with strong cross-region consistency — depends on TrueTime; choosing it for workloads that don’t need global distribution pays its complexity without using the capability that justifies it.

Topic: Pub/Sub (Order 6)

The broker can’t distinguish “still processing” from “consumer died.” Without auto-extension, a slow-but-healthy consumer’s in-progress message gets redelivered to a different consumer, causing duplicate processing or two consumers racing on the same work.

A very short ack deadline combined with a large extension window could produce a negative or near-zero delay — causing the client to extend “immediately, constantly” instead of on a sane schedule. The MinimumLeaseExtensionDelay clamp exists to prevent this.

The underlying HTTP response signals an error to Eventarc, which triggers the event source’s retry logic — the same at-least-once redelivery semantics as a Pub/Sub subscriber. Completion without throwing = success; throwing = failure.

They aren’t the same mechanism with a label. The client library maintains two separate LeaseTiming instances per channel — one for exactly-once, one for normal delivery — confirming genuinely different lease-management behavior under the hood, not just a naming difference.

Under high message volume, sending an individual extend-deadline call the instant every message’s timer fires creates a real load problem. The throttle interval batches/paces that traffic to prevent spiking the broker with extend requests.

Topic: GKE Workload Identity (Order 7)

Binding 1 is an IAM grant (roles/iam.workloadIdentityUser) authorizing the KSA to impersonate the GSA. Binding 2 is a KSA annotation telling the metadata server which GSA to hand tokens for. The IAM grant alone doesn’t tell the metadata server what to hand out; the annotation alone doesn’t grant impersonation permission.

serviceAccount:PROJECT.svc.id.goog[NAMESPACE/KSA_NAME] — a specific syntax GCP IAM understands as “this exact Kubernetes ServiceAccount in this exact namespace.” Getting any part wrong (wrong namespace, wrong KSA name) means the binding silently doesn’t apply to the Pod you think it does.

Workload Identity eliminates long-lived exportable secrets but requires both bindings to be correctly configured and adds the runtime token-fetched-on-demand step. Downloaded keys are simpler to set up but create a persistent, exportable credential that leaks mean permanent access.

Configuring only one of the two required bindings — the IAM grant or the KSA annotation. Missing either half is a real, common misconfiguration: the IAM grant alone doesn’t tell the metadata server what to hand out, and the annotation alone doesn’t authorize impersonation.

Workload Identity is for workloads running inside GKE — a KSA impersonates a GSA via two bindings and the metadata server. WIF is for external identities (GitHub Actions, other clouds) — it exchanges an OIDC token via Google STS with nothing stored on either side. Different trust boundaries, different mechanisms.

Topic: Cloud Functions (Order 8)

Every Cloud Function is invoked over plain HTTP, regardless of trigger type. For event-driven functions, Eventarc wraps the event as a CNCF CloudEvents-formatted HTTP POST, and the Functions Framework’s CloudEventAdapter parses it back into a structured CloudEvent. The transport is uniform — “event-driven” describes the encoding and source, not a separate mechanism.

The framework returns HTTP 400 before the user’s function code ever runs. Event-parsing failures and function-logic failures are separate error classes — a 400 in the framework logs means the event itself was malformed, distinct from an exception inside the handler.

It falls back to GcfConverters.ConvertGcfEventToCloudEvent for requests that aren’t standard CloudEvents — evidence Google Cloud Functions’ event format predates CNCF CloudEvents standardization, and the framework preserves backward compatibility for first-generation functions using the proprietary format.

The ICloudEventFunction.HandleAsync interface returns no success/failure value — completion itself IS the signal. The CLR’s exception mechanism is the entire error-reporting channel, so throwing = failure triggers redelivery, while returning normally = success with no extra translation needed.

When you need request-response semantics (the caller expects a synchronous reply) rather than fire-and-forget event processing. HTTP functions return a response to the caller; event-driven functions process asynchronously with at-least-once delivery and retry semantics managed by Eventarc.

Topic: Cloud Load Balancing (Order 9)

A single google_compute_global_address is announced from many Google edge locations simultaneously. BGP-level anycast routing sends each user’s traffic to the nearest edge at the network layer — no DNS TTL, no caching delay, no per-region IP management.

A Serverless NEG (network_endpoint_type = "SERVERLESS") references a Cloud Run service by name rather than IP or instance group. Serverless backends get their own NEG type because “backend address” isn’t a meaningful concept for something that scales to zero with no persistent instances.

DNS caching and TTLs delay failover, and it requires managing multiple separate IPs and LB instances, one per region. GCP’s global HTTP(S) load balancer is one resource with one global anycast IP — failover happens at the network layer without DNS propagation delay.

You need one Serverless NEG per region, each independently resolving to that region’s Cloud Run service. The global load balancer is aware of regional backend topology — one NEG per region per backend, not a single global reference.

The NEG references the service by name, and Google’s infrastructure resolves that name to the service’s current backend dynamically. The load balancer never needs to be told about instance count changes because it was never tracking individual instances — it just knows the service name.

Topic: Workload Identity Federation (Order 10)

An OAuth2 token exchange (RFC 8693) where GitHub’s own OIDC token is swapped for a Google Cloud token via Google STS. Google verifies the token against GitHub’s public keys and hands back a federated access token, with nothing long-lived stored on either side.

WIF eliminates long-lived secrets entirely — every run re-proves identity from scratch with a fresh token exchange. The tradeoff is setup complexity: you need a configured Workload Identity Pool/Provider on GCP and proper OIDC trust conditions, whereas a JSON key is simpler to set up but creates a persistent credential leak risk.

A deliberately short cache window avoids hammering the STS endpoint for every API call while still re-exchanging frequently enough that the cached token’s own short lifetime doesn’t become a practical long-lived credential in its own right.

Passing a raw string instead of the structured resource path //iam.googleapis.com/projects/.../workloadIdentityPools/.../providers/.... Google’s STS uses the audience to know which configured trust relationship to check the incoming token against — the wrong provider causes the exchange to fail safely rather than silently succeeding.

The exact URL and header needed to FETCH GitHub’s OIDC token, not the token itself. This lets downstream tools (Terraform, gcloud) authenticate the same way without the auth action handing them a live token that could go stale mid-run — the file describes how to fetch a fresh token when needed.

The federated token alone can call GCP APIs if granted permissions directly. Service account impersonation is an optional layer on top where the federated token is exchanged for a scoped token of a specific service account, useful when permissions should live on a dedicated service account rather than the federated identity itself.

Topic: Cloud Monitoring & Logging (Order 11)

SetTraceAndSpanIfAny stamps the currently-active trace and span ID onto every LogEntry at creation time — a concrete field, not a UI inference from timestamps. This is what powers Cloud Console’s “view logs for this trace” feature.

JsonPayload is a structured Struct where individual fields remain genuinely queryable in Cloud Logging’s query language after the fact. A formatted string is only discoverable via full-text search — you can’t reliably filter by user_id=123 without parsing the string back out.

SetTraceAndSpanIfAny is conditional — it simply doesn’t attach trace/span fields rather than failing or writing empty placeholders. Trace correlation is opportunistic: present when there’s an active context, silently absent otherwise.

Cloud Trace is a project-level concept. A logger writing at organization scope (logTarget.Kind != Project) structurally can’t attach trace correlation — the code computes _traceTarget as null for non-Project targets rather than attempting it and failing at request time.

Timestamps are unreliable under concurrent traffic and don’t scale. The real correlation is the trace ID and span ID stamped on each log entry by SetTraceAndSpanIfAny at creation time — a concrete, exact match, not a proximity guess.

Two separate ApplyTo(entry) calls merge labels from both ambient context (a using-block scope wrapping an operation) and thread-local current scope state. Labels attached at different call stack levels all end up on the same log line without the innermost call needing to know about them.

Topic: Terraform on GCP (Order 12)

GCP’s stable and beta API surfaces graduate features independently. The google provider tracks stable APIs; google-beta tracks the beta surface. A module needing even one beta-only feature routes that specific resource through google-beta while everything else defaults to stable google.

Assuming it means “this whole configuration is experimental.” In practice, production modules routinely use google-beta for specific, well-established resource configurations that simply haven’t graduated to the stable API surface — it’s a resource-by-resource API-surface selection, not a blanket risk signal.

They’re independent — bumping the beta provider’s allowed version range doesn’t require touching the stable provider’s constraint, and vice versa, because they genuinely track different underlying API surfaces with different release timelines.

provider_meta attributes API calls back to the specific module that generated them for usage telemetry. Since the same module makes calls through both providers, both need attribution wired up independently — calls via google-beta would go unattributed otherwise.

The apply fails because the stable provider’s resource schema doesn’t know about the beta-only field or resource type. The fix is routing that specific resource through google-beta via an explicit provider = google-beta attribute, not converting the entire module to beta.


Last updated: July 2026 Total Q&A: 68 across Google Cloud

Back to Q&A Index