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.
A customer is considering Anthos to run GKE both on-prem and on GCP. What are the real benefits and trade-offs here, and what operational considerations, networking, policy, security, licensing, should factor into your recommendation?
Sample Answer
Direct answer
Anthos, the capability Google now markets mostly under the GKE Enterprise umbrella (Anthos is still the name most engineers recognize it by) buys a customer one consistent Kubernetes operating model, API surface, and policy and security tooling across on-prem and GCP. That is genuinely valuable when the customer's real goal is operational consistency across environments they are already committed to running, and a poor fit if the goal is simply "run some workloads on-prem cheaply," because it adds a real subscription cost and operational learning curve on top of running Kubernetes on-prem directly, a cost that only pays for itself when the consistency it provides is something the customer would otherwise have to build and maintain by hand.
Weighing the recommendation
Real benefits
One control-plane experience and API surface whether a cluster runs on GCP, on-prem through VMware or bare metal, or, via attached clusters, on another cloud's Kubernetes, so platform tooling, RBAC (role-based access control, the system that governs which identities can perform which actions) conventions, and upgrade tooling don't fork into "the GCP way" and "the on-prem way." Centralized configuration and policy tooling (Config Sync and Policy Controller under current branding) applies the same kind of guardrails a well-run shared Kubernetes platform needs, namespace quotas, admission policy, RBAC conventions, consistently across every cluster from one source of truth, instead of each environment's platform team reinventing its own version. A service mesh (a dedicated infrastructure layer that handles service-to-service traffic, security, and observability so individual services don't each have to implement it themselves), Cloud Service Mesh in GCP's current branding, works the same way across environments too, extending the mTLS (mutual TLS, a handshake where both sides of a connection present and verify a certificate, not just the server as in ordinary TLS) and traffic-management story from the multi-region GKE design to on-prem clusters, not just GCP-hosted ones.
Real trade-offs
Licensing and cost is a genuine, ongoing line item on top of whatever compute the customer already runs, historically priced per unit of managed infrastructure, that a customer running plain on-prem Kubernetes today doesn't currently pay, and it needs to be weighed against the engineering time it would otherwise take to build equivalent cross-environment consistency by hand. There's a real operational learning curve too, teams fluent in plain on-prem Kubernetes need to learn this platform's specific config-management and fleet-management model, that's a genuine ramp-up cost, not a drop-in replacement for what they already run. Networking and connectivity matter as well, on-prem clusters need reliable, sufficiently low-latency connectivity back to GCP for fleet management and telemetry functions, an unreliable link between the customer's data center and GCP becomes a platform reliability risk that didn't exist when everything ran purely on-prem.
Policy and security as an operational consideration, not just a benefit
The tooling above gives you the enforcement mechanism for consistent policy, but someone still has to author and own those organization-wide policies, and the security team needs to learn this specific tooling rather than whatever policy engine or process they already use on-prem. That adoption cost is real and distinct from the licensing line item, and it deserves its own line in the recommendation rather than being folded silently into "benefits."
Recommendation framing
Recommend this when the customer's actual pain is fragmented policy, security, and tooling across environments they're already committed to running, on-prem for latency, data residency, or existing hardware investment reasons, alongside a larger GCP footprint. Recommend against it when the on-prem footprint is small, temporary, or already well-served by a lightweight Kubernetes setup, in that case the subscription cost buys consistency the customer doesn't have enough surface area to benefit from yet.
Worked example
A manufacturing customer runs latency-sensitive control systems on factory-floor Kubernetes clusters, which must stay on-prem for the life of those factories, alongside a much larger GCP footprint for everything else. Without this platform, their security team maintains two separate policy models and two separate ways of enforcing "no privileged containers" and "images must be scanned," and platform engineers context-switch between two different toolsets. With it, the same admission-control and config-management approach a security-conscious, shared Kubernetes platform needs is defined once and applied to both the factory-floor clusters and the GCP clusters, and the subscription cost is justified against the real alternative, paying platform engineers to build and maintain that consistency by hand across two genuinely different environments indefinitely.
Trade-offs and pitfalls
Recommending this as a default "best practice" for any hybrid setup without sizing the actual on-prem footprint is a common pitfall, a customer with one small on-prem cluster and a short timeline to fully leave on-prem may never recoup the subscription cost before that cluster is decommissioned. Underestimating the connectivity requirement is another, a customer whose data-center-to-GCP link is unreliable or bandwidth-constrained will feel that as platform instability, not just a networking inconvenience, name that risk explicitly before recommending anything, not after. A third pitfall is conflating "we adopted this platform" with "our security posture is automatically better," it gives you the tooling to enforce consistent policy, it does not enforce good policy by itself, someone still has to define the actual rules.
Architect a streaming ingestion pipeline handling roughly 1TB of events a day, landing in BigQuery (or Bigtable where it fits better), using Pub/Sub and Dataflow. How would you handle partitioning and windowing, keep it fault-tolerant under bursty load, and control cost?
Sample Answer
Direct answer
Land events in Pub/Sub as the durable ingestion buffer, process them in Dataflow for windowing and any transformation, and write to BigQuery for aggregate/analytical access or Bigtable for high-throughput point lookups keyed by entity (whichever the downstream access pattern actually needs, and possibly both from the same pipeline). At roughly 1TB (terabyte) a day, this is a moderate, well-trodden scale: fixed or sliding time windows on event time (not processing time) with a bounded allowed-lateness for stragglers, Dataflow's autoscaling plus Pub/Sub's own buffering absorb bursty load without manual capacity planning, and cost is controlled mainly by keeping the pipeline's window and trigger choices from fanning out more output than the business actually needs.
Structured elaboration
Partitioning and windowing. Use fixed windows (for example, 1-minute or 5-minute tumbling windows) on event time if the destination is BigQuery and the consumer wants regular aggregates, or session windows if the goal is grouping bursts of related activity per entity. Set an allowed lateness (how long to wait for a straggling event after the watermark passes) sized to your actual observed event delay, not a guess, and use a write.to_bigquery with a late-arrival trigger firing an update rather than dropping late data outright if correctness matters more than a hard latency bound. Partition the BigQuery destination table by the window's event date so downstream consumers get the pruning benefit for free.
Fault tolerance and retries under bursty load. Pub/Sub decouples the producers from the processing rate: publishers keep succeeding even if Dataflow temporarily falls behind, because messages sit durably in Pub/Sub (retained up to 31 days) until a subscriber pulls and acknowledges them. Pub/Sub's default delivery guarantee is at-least-once, so a Dataflow worker that dies mid-batch (a real risk during a burst, if autoscaling is adding and removing workers) simply causes those in-flight messages to be redelivered once the ack deadline passes, and Dataflow's own checkpointing resumes windowing state correctly rather than losing progress; this combination is what makes retries safe by default rather than something the pipeline author has to build. Dataflow's autoscaling adds workers as backlog grows and removes them as it drains; the main operational risk under a burst is not data loss but a temporarily growing end-to-end latency, which is a capacity/cost trade-off to size for explicitly (how much backlog, and for how long, is acceptable) rather than an afterthought. If a specific entity (say, a single device or user) needs its events processed in the order they were produced, an ordering key scoped to that entity's ID gives that guarantee cheaply for the traffic that actually needs it, without forcing every event in the topic through a single ordering constraint it doesn't need.
Cost control. The three real levers are: Dataflow worker count and machine size (an overprovisioned max-workers setting pays for idle capacity between bursts), the destination write pattern (BigQuery streaming inserts cost more per row than periodic micro-batch loads via the Storage Write API, so batch the writes if sub-second landing latency isn't actually required), and Pub/Sub subscription count (each additional subscription re-reads and re-bills the full message stream, so fan out downstream inside Dataflow rather than creating a new Pub/Sub subscription per consumer when the same transformed data serves multiple sinks).
flowchart LR
A[Event producers] --> B[Pub/Sub topic]
B --> C[Dataflow: windowing + transform]
C -->|aggregates| D[BigQuery]
C -->|point lookups by key| E[Bigtable]
Worked example
1TB/day, if events average 1KB (kilobyte) each, converts to a concrete throughput target:
1 TB=1012 bytes,86,400 s1012 bytes≈1.157×107 bytes/s≈11.57 MB/s 1,024 bytes/event11.57×106 bytes/s≈11,300 events/s averageReal traffic isn't flat: if the daily pattern peaks at, say, 6x the average during a business-hours burst, that's roughly 68,000 events/s at peak, well within a single Pub/Sub topic's throughput ceiling and a modest Dataflow autoscaling range, but it's the number that should actually drive your worker-count and subscription-quota planning, not the 11,300/s daily average.
Trade-offs & pitfalls
- Choosing BigQuery streaming inserts by default because "it's simple" is a common way to overpay: at this event rate, batching writes every 30 to 60 seconds via a Dataflow-managed load into BigQuery (or the Storage Write API's batch mode) is materially cheaper for a negligible latency cost, unless a specific downstream consumer genuinely needs sub-minute freshness.
- Allowed lateness set too short silently drops legitimately late data (mobile clients reconnecting after being offline are a classic source); set too long, it keeps window state open and increases Dataflow's memory footprint per key.
- A separate Pub/Sub subscription per downstream consumer multiplies your Pub/Sub bill by the number of consumers for the same underlying stream; prefer one subscription into Dataflow and fanning out from there when possible.
- This design doesn't need Bigtable at all if every downstream consumer only wants aggregates; adding it "for scale" when nobody needs sub-10ms point lookups is unnecessary operational surface.
Provide the exact gcloud CLI commands, in order, to create a custom VPC, create a subnet within it in us-central1 with a specific IP range, and create a firewall rule allowing inbound HTTP traffic from anywhere to VMs with a given network tag. Write them so they can be copy-pasted directly.
Sample Answer
Approach
Three commands, in order, because each one depends on the resource the previous one created: a custom-mode VPC (Virtual Private Cloud, a network you fully control the address space and subnets for) first, then a subnet inside it, then a firewall rule that references both the network and a tag rather than opening access to every instance on it.
Commands
# 1. Custom-mode VPC: no subnet auto-created in every region.
gcloud compute networks create demo-vpc \
--subnet-mode=custom \
--bgp-routing-mode=regional
# 2. Subnet in us-central1 with an explicit CIDR (Classless Inter-Domain
# Routing) range.
gcloud compute networks subnets create demo-subnet-us-central1 \
--network=demo-vpc \
--region=us-central1 \
--range=10.10.0.0/24
# 3. Firewall rule: allow inbound HTTP (tcp:80) from anywhere, scoped to
# instances carrying the "web" network tag.
gcloud compute firewall-rules create allow-http-web \
--network=demo-vpc \
--direction=INGRESS \
--action=ALLOW \
--rules=tcp:80 \
--source-ranges=0.0.0.0/0 \
--target-tags=web
These flags were checked against current gcloud reference documentation for compute networks create, compute networks subnets create, and compute firewall-rules create; no gcloud CLI or credentials are available in this sandbox, so the commands are verified for correct, current syntax, not by having actually run them here.
Key points
Order matters: the network has to exist before a subnet can reference it, and the subnet's network has to exist before a firewall rule can be scoped to it. --subnet-mode=custom is what prevents GCP from auto-creating a subnet in every region, the default "auto" mode does that, convenient for a five-minute prototype and unwanted sprawl for anything meant to be handed off or kept around. The firewall rule's --target-tags=web is what actually narrows "inbound HTTP from anywhere" down to only tagged instances; an instance only receives this rule if it was created with --tags=web, so the rule alone does not open anything until something is tagged to match it.
Trade-offs and edge cases
--source-ranges=0.0.0.0/0 covers all IPv4 sources but says nothing about IPv6; if an instance ever acquires an IPv6 address, this rule alone will not explain whether it is reachable over IPv6, that needs its own range or rule. --bgp-routing-mode=regional, chosen here, versus global affects how routes propagate later if this VPC grows a Cloud VPN or Cloud Interconnect (a dedicated private physical link to Google's network from an on-premises data center) connection, worth deciding deliberately up front rather than accepting whichever default the CLI applies. Running gcloud compute firewall-rules create a second time with the same rule name fails instead of updating the existing rule; changes to an existing rule need gcloud compute firewall-rules update, a common first mistake when iterating on a rule's ports or ranges.
Compare Cloud SQL, Cloud Spanner, Firestore, and Bigtable as managed database options on GCP: data model, consistency guarantees, scalability, and typical use case. Can you map four different application patterns to the service that fits each best?
Sample Answer
Direct answer
The four sit on two axes: relational versus non-relational, and single-region-scale versus horizontally-distributed-scale. Cloud SQL is a single-region relational database for standard transactional applications. Cloud Spanner is a globally-distributed relational database for applications that need both strong consistency and horizontal write scale beyond what one machine can do. Firestore is a document database for applications built around flexible, hierarchical JSON-like records with real-time sync to clients. Bigtable is a wide-column store for massive-scale, high-throughput workloads with simple, known access patterns (look up by key, or scan a key range).
Structured elaboration
| Service | Data model | Consistency | Scalability | Typical use case |
|---|---|---|---|---|
| Cloud SQL | Relational (MySQL, PostgreSQL, SQL Server) | Strong (ACID: atomicity, consistency, isolation, durability) within a region | Vertical, plus read replicas; a single primary handles all writes | Standard application backend: orders, accounts, CMS content |
| Cloud Spanner | Relational, but horizontally partitioned (sharded) across nodes | Strong, globally (external consistency) | Horizontal, across regions if needed; scales writes, not just reads | Global financial ledgers, inventory systems needing both scale and strict consistency |
| Firestore | Document (collections of JSON-like documents) | Strong within a database instance; supports real-time listeners | Automatic horizontal scaling, serverless | Mobile/web apps needing real-time sync, offline support, flexible schema |
| Bigtable | Wide-column (sparse, sorted key-value rows with column families) | Strong per-row only (no multi-row transactions) | Massive horizontal scale, linear with node count | Time-series, IoT telemetry, ad-tech clickstreams, ML feature stores |
Four application patterns mapped to a fit:
- A subscription billing system needing foreign keys between customers, invoices, and payments, with standard SQL joins and moderate write volume: Cloud SQL. The relational model and ACID transactions match the domain directly, and the write volume doesn't need horizontal sharding.
- A global multiplayer game's inventory and matchmaking ledger, needing strict consistency (an item can't be duplicated by a race condition) at a write volume no single machine could sustain, across players worldwide: Cloud Spanner. This is the case that specifically needs both properties Cloud SQL doesn't offer together: horizontal write scale and strong consistency.
- A collaborative note-taking or task app with a mobile client that needs to work offline and sync automatically when reconnected, with a flexible per-document schema (some notes have attachments, some have checklists): Firestore. The document model and built-in real-time listener/offline-sync support solve exactly that client-facing problem.
- An IoT platform ingesting sensor telemetry from millions of devices, where the access pattern is almost entirely "write a new reading" and "scan a device's recent readings by time range," with no need for joins or multi-row transactions: Bigtable. Its wide-column model and linear scaling handle this write-heavy, simple-access-pattern workload far more cheaply per unit of throughput than a relational engine would.
Worked example
Take the same underlying entity, a "user session," across two of these services to show the model actually drives the choice, not habit. In Cloud SQL, a sessions table with a foreign key to users, queried with a JOIN to fetch session plus user profile in one round trip, fits naturally because the access pattern is relational (session belongs to exactly one user, and you often want both together). In Bigtable, the same conceptual data modeled as row_key = user_id#reverse_timestamp, with columns for session metadata, fits a workload that instead needs "give me this user's most recent 50 sessions, fast, at massive scale, with no joins," because the reverse-timestamp suffix keeps a user's most recent sessions physically adjacent for fast range scans without needing a secondary index. The same "session" concept, modeled two structurally different ways, because the question being asked of the data differs.
Trade-offs & pitfalls
- Reaching for Spanner as a default "just in case we need to scale" choice when Cloud SQL would comfortably handle the actual write volume adds real operational and cost overhead (Spanner's minimum viable footprint costs more than a modest Cloud SQL instance) for a scale problem you don't have yet.
- Using Firestore for data that's genuinely relational (heavy cross-collection joins simulated via multiple reads and client-side merging) fights the model; Firestore has no server-side join, so relational-shaped data forces either denormalization (duplicating data across documents, with the consistency risk that implies) or multiple round trips.
- Using Bigtable for anything needing multi-row transactions or ad hoc query flexibility is a common mismatch; Bigtable's atomicity guarantee stops at a single row, and its query model is fundamentally "scan by key or key range," not "filter by an arbitrary non-key column" without a design decision baked into the row key up front.
Design a highly available, multi-region relational database architecture for a global transactional application that needs low latency and strong consistency. Cloud SQL doesn't offer a global primary the way Spanner does, so walk through Spanner's multi-region configuration versus building a cross-region Cloud SQL topology, and justify your recommendation, including how each handles failover and replication.
Sample Answer
Direct answer
For a global transactional application needing low latency and strong consistency, Spanner's multi-region configuration is the right recommendation over a hand-built cross-region Cloud SQL topology, because Cloud SQL fundamentally has one authoritative primary. A cross-region Cloud SQL setup can give you regional read replicas for low-latency reads, but every write still goes through a single primary in one region, meaning every write from anywhere in the world pays that primary region's round-trip latency, and a regional outage of the primary is a real, manual failover event, not an automatic one. Spanner's multi-region configuration distributes both reads and a quorum-based write path across regions natively, giving strong (in fact, stronger than typical "strong consistency": external consistency) guarantees globally with automatic failover, at the cost of higher baseline write latency than a single-region deployment and real cost and design complexity.
Structured elaboration
Spanner multi-region configuration. A multi-region configuration designates a default leader region (housing the leader replicas for each shard), a second read-write region, and a witness region that holds a voting replica without serving reads, plus optional additional read-only regions for low-latency local reads elsewhere. Every write forms a quorum: one of the replicas in the leader region plus two of the four remaining voting replicas across the other regions must agree before a write commits, which is what gives Spanner external consistency (a guarantee stronger than standard strong consistency, meaning transaction order is preserved in a way consistent with real time globally, not just per-object). Multi-region configurations offer higher availability than a regional one (99.999% versus 99.99%), precisely because losing any single region still leaves enough voting replicas to form a quorum.
Cross-region Cloud SQL topology. The realistic version of "cross-region Cloud SQL" is one primary in a home region with cross-region read replicas near other user populations, so reads local to those replicas are fast, but every write anywhere still round-trips to the single primary's region. A regional outage of the primary requires promoting a replica to primary, which is an operator-initiated (or scripted) failover with a real recovery time, not the automatic, sub-second quorum failover Spanner's model provides. There's no native Cloud SQL feature that gives you a globally-distributed write path with strong consistency; building an approximation (application-level sharding by geography, conflict resolution logic for cross-region writes) is a significant, ongoing engineering investment that's reinventing a narrower, less battle-tested version of what Spanner provides as a managed service.
Failover and replication compared directly:
| Property | Spanner multi-region | Cross-region Cloud SQL |
|---|---|---|
| Write path | Quorum across regions, every write | Single primary region, always |
| Read path | Any read-write or read-only region, strongly consistent | Local replica, but replica reads can lag the primary |
| Failover on regional outage | Automatic, quorum re-forms without the lost region (if it's not the leader; leader region loss triggers an internal leadership transfer) | Manual or scripted promotion of a replica to primary |
| Consistency guarantee | External consistency, globally | Strong on the primary; replicas are typically eventually consistent for reads |
| Write latency | Higher than single-region, due to cross-region quorum communication | Low locally to the primary; high from anywhere else, since all writes route there |
Recommendation and justification. For a genuinely global, write-heavy transactional application needing strong consistency (the stated requirement), recommend Spanner's multi-region configuration: it's the only one of the two that actually gives strongly-consistent writes with low latency from more than one region, because Cloud SQL's single-primary architecture makes "low latency writes from everywhere" and "one authoritative primary" mutually exclusive. If the actual requirement, on closer inspection, turns out to be "low-latency reads globally, but writes can tolerate one region's latency" (a materially different and more common requirement than it first sounds), a cross-region Cloud SQL topology with regional read replicas is simpler, cheaper, and sufficient, so it's worth explicitly confirming which requirement is real before committing to Spanner's added cost and complexity.
Worked example
A global ride-hailing dispatch system needs a driver's location update and a rider's booking confirmation to be consistent worldwide (a driver can't be double-booked across two regions' views of the same fleet), with drivers and riders spread across North America, Europe, and Asia. On Spanner, a multi-region configuration spanning those three regions gives every region low-latency local reads and a consistent write quorum, so a booking confirmed in Europe is immediately, correctly reflected if queried from Asia. On cross-region Cloud SQL with a single primary in, say, us-central1, every booking write from Europe or Asia pays a full round trip to the US regardless of how many local read replicas exist, and a us-central1 regional outage means dispatch is down globally until a replica is manually promoted, both of which directly violate the stated low-latency and strong-consistency requirements. The identical argument holds for a global financial-services application processing payments across the same three regions: a payment authorization is the same kind of write that must be immediately, consistently visible everywhere (to prevent the same funds being authorized twice from two regions), so the recommendation and the reasoning behind it don't change just because the domain moves from ride-hailing to payments.
Trade-offs & pitfalls
- Recommending Spanner without confirming the write requirement genuinely needs global strong consistency (rather than just global low-latency reads) means paying for capability the application doesn't use; verify which property the business actually needs before defaulting to the more powerful option.
- Spanner's multi-region write latency is real and higher than single-region Spanner or a well-placed Cloud SQL primary serving nearby users; a workload that's latency-sensitive on writes specifically (not just consistency-sensitive) needs to be tested against that added latency, not assumed away.
- A cross-region Cloud SQL topology can look deceptively similar to Spanner on paper (multiple regions, replicas), which is exactly what makes it easy to mis-recommend for a workload that actually needs strongly-consistent global writes; the failover behavior and write-path latency are where the architectures diverge in practice, not just theory.
Unlock Full Question Bank
Get access to all Google Cloud Platform Services and Architecture interview questions and detailed answers.
Sign in to ContinueJoin thousands of developers preparing for their dream job.