Google Cloud Platform Services and Architecture Questions
Google Cloud Platform's core services and architecture: Compute Engine, Cloud Run, GKE, Cloud Storage, VPC, managed databases (Cloud SQL, Spanner, Firestore, Bigtable), and BigQuery-adjacent data services. Covers GCP service selection, networking, IAM and security specifics, cost and quota management, and reference patterns for building on the platform. For provider-agnostic compute, storage, or networking concepts, see the cross-cloud entries.
Design a least-privilege IAM model for an enterprise where developers can deploy to development projects but only the operations team can deploy to production. How would you handle the service accounts used by CI/CD, group and grant roles to teams, use IAM Conditions, and set up an audit process to make sure it's actually being followed?
Sample Answer
Direct answer
The core mechanism is a project structure that separates environments, dev projects grouped under one folder, production under another, so environment boundaries are actual project boundaries, not just role names inside one shared project. Then map every deploy path, human or CI/CD, to a principal whose IAM (Identity and Access Management) grant is scoped to exactly the projects it should reach: developers and their CI/CD service account get deploy roles on dev projects only, and a separate, tightly controlled CI/CD service account, used only by the production-promotion stage and gated by a human approval, is the only principal with a deploy role on the production project.
Designing the model
Project and folder structure
Group dev projects under one folder and production under another, granting IAM roles at the folder level for the common case (developers get a deploy role across the whole dev folder) rather than repeating identical grants project by project. This same folder pattern is exactly how you onboard a new team across multiple projects too, grant the team's group a role at the folder covering their projects once, rather than hand-granting per project per person, so the design that solves "dev versus prod" also solves "add a fifth team next quarter" without new plumbing.
CI/CD service accounts
Use a distinct service account per pipeline stage: a "deploy-to-dev" service account scoped to dev projects, and a separate "deploy-to-prod" service account scoped only to the production project, invoked exclusively from the production-promotion pipeline stage, ideally gated by a required approval in the CI/CD tool itself. Even if the general dev-facing pipeline is compromised, the attacker does not inherit production deploy rights, that identity simply isn't reachable from there.
Grouping and granting to teams
Grant roles to Google Groups mapped to team membership, a "developers" group, an "ops" group, not to individuals. Adding or removing someone from a team becomes a group-membership change, which is also what makes an audit tractable later, checking group membership against a team roster instead of diffing raw IAM bindings.
IAM Conditions
IAM Conditions attach an expression to a role binding so it only applies under specific circumstances, for example limiting a broad deploy role to a defined change window, or restricting it to resources matching a naming pattern as an extra guardrail on top of the project split itself. Use Conditions as a second layer of defense, not a substitute for the project boundary, a condition is an expression that can have a bug, a project boundary is a hard wall.
Audit process
Two different audits matter here: a periodic IAM policy review comparing who has what role on which project or folder against the intended model, and a review of Cloud Audit Logs for actual deploy actions against production, confirming who really deployed and when, and specifically whether anyone bypassed CI/CD and deployed to production directly with a human credential, which the model above should make structurally difficult, and the log audit confirms it's actually rare rather than just theoretically rare.
Worked example
A developer's laptop credentials get phished. Because that developer's IAM grant is scoped to the dev folder only, the attacker can deploy garbage to a dev project, annoying but contained, and cannot reach production because there is no binding anywhere granting that identity, or any service account it normally uses, a role on the production project. The audit trail confirms the containment: Cloud Audit Logs show deploy activity in dev projects from that identity and nothing in production's logs, exactly the evidence an incident review needs to prove the blast radius stayed contained.
Trade-offs and pitfalls
A common pitfall is granting a "just in case" broad role to the general CI/CD service account so it can deploy anywhere, which collapses the entire design back into one shared, powerful identity. A second pitfall is relying on IAM Conditions as the only control instead of a project boundary, conditions can be written incorrectly and are harder to audit at a glance than "which project is this role bound to." A third pitfall is auditing IAM policy bindings but never cross-checking against actual deploy logs, a clean-looking policy tells you nothing about whether someone found a side door, a personal token, a break-glass account, that bypasses it entirely. Separate service accounts and a folder structure add real setup overhead up front, but retrofitting isolation after a real incident forces the redesign under far worse conditions.
Explain what Cloud Armor does for a web application and how you'd use it against DDoS and layer-7 attacks. What would you watch for when tuning WAF rules so you don't generate a wave of false positives?
Sample Answer
Direct answer
Cloud Armor sits in front of a web application at the load balancer and does two related but distinct jobs: it absorbs and filters high-volume Layer 7 (application-layer) Distributed Denial of Service, or DDoS, traffic using Adaptive Protection, a machine-learning system trained on the app's own baseline traffic, and it acts as a Web Application Firewall (WAF), matching requests against preconfigured rule sets and custom rules to block things like SQL injection or cross-site scripting attempts before they reach the backend. Tuning it well means never flipping a new rule straight to blocking traffic; every rule goes through a preview period against real traffic first.
Structured elaboration
Against DDoS
- Adaptive Protection continuously baselines what normal traffic to the application looks like, then flags anomalous surges consistent with a Layer 7 DDoS attack and can suggest a specific WAF rule to mitigate it, which a human reviews and applies rather than the system silently blocking traffic on its own.
- Rate-based rules (a "throttle" action) cap requests per client IP or other key within a time window and return a 429 (Too Many Requests) status once exceeded, rather than banning the client outright, which is the right default for protecting backend capacity from a spike without permanently locking out a legitimate but overeager client.
Against Layer 7 attacks (the WAF side)
- Preconfigured WAF rules ship dozens of signatures per category (SQL injection, cross-site scripting, remote code execution, and others), each modeled on the ModSecurity Core Rule Set, giving broad OWASP (Open Worldwide Application Security Project) Top 10 coverage without writing rules by hand.
- Custom rules layer on top for anything specific to the application: named IP allow or deny lists, geographic restrictions, or matching on a header or path unique to the app.
Tuning to avoid false positives
- Never enable a new or preconfigured rule directly in "deny" mode. Cloud Armor supports a preview mode where a rule logs what it would have matched without blocking anything, so the actual hit rate against real production traffic is visible before enforcement.
- Read the preview logs for false positives before switching to deny, and where a specific field (a legitimate JSON payload that happens to resemble an injection pattern, for instance) keeps tripping a signature, use a field-level exclusion for that request attribute rather than disabling the whole rule or the whole preconfigured set.
- Preconfigured rules ship with a sensitivity level, sometimes called a paranoia level, and starting at the lowest sensitivity and raising it deliberately, one review cycle at a time, catches more false positives before they reach production than starting at maximum strictness.
Worked example
An e-commerce checkout API is fronted by an external Application Load Balancer with Cloud Armor attached. The SQL injection preconfigured rule is enabled in preview mode first; over a week, the logs show it repeatedly matching on a legitimate notes field where customers type things like O'Brien's order or paste text containing a single quote and a dash, both of which superficially resemble SQL injection syntax. Rather than disabling SQL injection protection for the whole API, an exclusion is added for that specific field, the rule is left enforced for every other field and endpoint, and it's switched from preview to deny only after a second review shows the exclusion eliminated the false positives without missing any real attack signatures in the same log window.
Trade-offs & pitfalls
Turning on every preconfigured rule at high sensitivity and switching straight to deny is the fastest way to break the application for real customers, not attackers: legitimate input that merely resembles an attack pattern (special characters in free-text fields, for instance) is a common source of false positives, and discovering that only after go-live means an outage caused by your own security tooling. On the DDoS side, relying solely on IP-based rate limiting without Adaptive Protection misses distributed attacks that spread load across thousands of source IPs, each individually under any reasonable per-IP threshold.
Design a zero-trust architecture for microservices running across GKE and Cloud Run. What role would mTLS, Identity-Aware Proxy, Workload Identity, and a service mesh like Istio play, and how would you roll this out incrementally without breaking existing traffic?
Sample Answer
Direct answer
Zero trust here means no service call is trusted just because it originated inside the network perimeter, every call is authenticated and authorized on its own merits. The design layers mutual TLS (mTLS, a handshake where both sides of a connection present and verify a certificate, not just the server) for service-to-service identity and encryption, Identity-Aware Proxy (IAP) for human and external access into the system, Workload Identity so each service authenticates to Google Cloud APIs with its own scoped, short-lived credential, and a mesh, Istio or GCP's managed Cloud Service Mesh, to make mTLS and authorization policy consistent and centrally manageable across both GKE (Google Kubernetes Engine) and Cloud Run, rather than something each service team implements independently. Rolling this out incrementally means running mTLS in permissive mode first, accepting both plaintext and mTLS, so nothing breaks for a caller that hasn't been onboarded yet.
The design and the rollout
The four pieces and what each one authenticates
mTLS gives every service-to-service call cryptographic proof of which service is calling and encrypts the traffic, closing the gap where "it's on the internal network" was previously treated as sufficient trust. IAP sits in front of the parts of the system humans or external clients reach directly, checking identity and context, device, IP, group membership, against policy before a request ever reaches the application, replacing "you're on the VPN, therefore trusted" with a per-request check. Workload Identity, the GKE-native mechanism that lets a pod authenticate to Google Cloud APIs with a short-lived, automatically rotated credential instead of a downloaded key, here specifically ensures each service's calls out to Google Cloud APIs carry that service's own scoped credential rather than a shared or broad one. The service mesh is what actually enforces mTLS and fine-grained authorization policy consistently, and critically extends across both GKE and Cloud Run, so a GKE service calling a Cloud Run service, or the reverse, gets the same mTLS and policy enforcement as two services inside the same GKE cluster, rather than that boundary becoming an unencrypted, unauthenticated gap in an otherwise zero-trust system.
Rolling out without breaking traffic
Start with mTLS in permissive mode, namespace by namespace or service by service, so services already in the mesh and services not yet onboarded can keep talking to each other without interruption during migration. Flip to strict mode, mTLS only, plaintext rejected, only after confirming, via the mesh's own traffic telemetry, that no caller of a given service is still connecting in plaintext. Do this service by service rather than as one cluster-wide cutover, the same incremental-rollout discipline any default-deny security control needs, for the same reason: a big-bang cutover breaks every not-yet-onboarded caller at once. Sequence IAP and Workload Identity rollout similarly, IAP in front of one entry point at a time, Workload Identity migrated service by service, since a service still using a downloaded key can coexist with services already on Workload Identity during the transition.
Authorization, not just encryption
mTLS alone only proves who is calling, zero trust also means enforcing whether that caller is allowed to make that specific call. The mesh's authorization policies, allowing only specific service identities to call specific other services on specific methods, are what actually implement least-privilege service-to-service access on top of the identity mTLS establishes.
Worked example
A GKE-hosted order service currently calls a Cloud Run-hosted pricing service over plain HTTPS, with no service identity verification beyond trusting the pricing service's URL. Both services join the mesh with mTLS in permissive mode, traffic keeps flowing exactly as before while the mesh's proxy also starts offering mTLS on the side. Mesh telemetry confirms after a monitoring period that the order service's calls to pricing are consistently arriving as mTLS, not falling back to plaintext, at which point pricing's mesh policy flips to strict mode, and by this point nothing is actually still sending plaintext calls, so nothing breaks. An authorization policy is then added restricting the pricing service to accept calls only from the order service's specific workload identity, not from every service in the mesh, closing the access-control gap that encryption alone never addressed.
Trade-offs and pitfalls
Flipping mTLS straight to strict mode cluster-wide to "get zero trust done faster" is the single most common way this kind of rollout causes an outage, some caller nobody remembered is still on plaintext. Treating mTLS as the whole solution and skipping authorization policy is another, encrypted and authenticated traffic between two services that shouldn't be talking to each other at all is still a zero-trust gap, just a quieter one. It's also worth naming that Cloud Run's mesh integration and GKE's are configured somewhat differently operationally, teams that only test the rollout on GKE can be surprised by what's different when extending it to Cloud Run. Running a full service mesh adds real operational overhead, its own upgrade cycle, added latency from the proxy hop, a new thing to debug when something goes wrong, a genuine trade-off against the security gained, not a free upgrade.
Design a Zero Trust architecture for an enterprise that spans multiple clouds, using Identity-Aware Proxy, BeyondCorp principles, VPC Service Controls, and Private Service Connect. How would authentication, service-to-service communication, and short-lived credentials work together, and what would a pilot with a single application team look like?
Sample Answer
Direct answer
This is the perimeter-and-identity layer of zero trust, distinct from a service mesh's job of securing service-to-service traffic inside a single compute platform like GKE or Cloud Run. BeyondCorp is Google's underlying philosophy, access decisions based on device and user context rather than network location. Identity-Aware Proxy (IAP) is the enforcement point implementing that philosophy for human access to applications. VPC Service Controls draws a data-exfiltration perimeter around managed GCP services regardless of identity or IAM (Identity and Access Management) permissions. Private Service Connect gives services in different networks, including a different cloud, private connectivity to each other without that traffic ever traversing the public internet.
How the four pieces fit together
BeyondCorp and IAP: human access, replacing the VPN model
BeyondCorp's core claim is that being on the corporate network should grant zero implicit trust, every access decision is made per request based on who the user is, what device they're on, and other context, not on network location. IAP is the practical enforcement point specific to application access, it sits in front of an application and checks identity, device, and context against policy before the request is allowed through, replacing "connect to the VPN, then you're trusted" with a per-request check that works the same whether the user is in an office or on a coffee-shop network.
VPC Service Controls: the data-exfiltration perimeter
Where IAM answers "does this identity have permission," VPC Service Controls answers a different question entirely: "even with valid credentials, can data cross this boundary at all." It creates a perimeter around a set of GCP services such that data cannot be copied out to a resource outside the perimeter, even by someone with legitimate IAM permissions on both sides, which specifically defends against a stolen or overly broad credential being used to exfiltrate data, something IAM policy alone cannot stop since IAM can only say yes or no to an action, not "yes, but only within this boundary."
Private Service Connect: private cross-network connectivity
Lets a service in one network reach a service in another network, a different VPC, a different cloud, via a private internal address rather than the public internet or a full network peering that would expose more of each network to the other than necessary. For a multi-cloud enterprise, this is what lets a service on GCP privately reach a service hosted on another cloud, or vice versa via that cloud's own equivalent feature, without opening the traffic to the public internet.
Authentication, service-to-service, and short-lived credentials together
Human authentication runs through IAP plus the organization's identity provider via single sign-on, enforced per request, with no standing VPN trust. Service-to-service authentication uses Workload Identity for GCP-hosted services and Workload Identity Federation for services on another cloud calling GCP APIs, or that cloud's own equivalent mechanism for the reverse direction, all short-lived and scoped, with no long-lived credential ever copied between environments. Short-lived credentials are the common thread across all of it, whether it's a human's IAP-mediated session, a service's Workload Identity token, or a cross-cloud federated token, none of them remains valid and unrevoked for weeks or months, which is what makes "zero trust" more than a label, a compromised credential in this design has a short, bounded window of usefulness.
Piloting with a single application team
Pick one team with real cross-boundary access needs, calling another team's service, touching a sensitive data store, or serving both internal and external users, a team with a trivial access pattern won't exercise these mechanisms meaningfully. Put IAP in front of just that team's application first to confirm legitimate users aren't locked out, configure a VPC Service Controls perimeter scoped to just that team's sensitive services rather than organization-wide, so a misconfiguration has a contained blast radius (a small, bounded scope of what breaks, not an organization-wide outage), and set up Private Service Connect only for the specific cross-network dependency that team actually has. Measure the pilot on two things: did access break for anyone who should have had it, and can a deliberate attempt to move data across the new perimeter with valid but out-of-scope credentials be shown to fail.
Worked example
A finance application team needs employees to access sensitive financial reports, human access, IAP's job, while the application's backend also needs to privately call an analytics service hosted on a partner's account on another cloud, cross-cloud service-to-service, Private Service Connect's job, and the whole system must not let anyone, even with valid access, copy the underlying financial dataset out to an external storage bucket, VPC Service Controls' job. The pilot stands up IAP in front of the reporting application, a VPC Service Controls perimeter around the project holding the financial dataset, and Private Service Connect for the specific path to the partner's analytics service, all scoped to this one team. A test where a team member with legitimate IAM read access on the dataset attempts to export it to a personal storage bucket outside the perimeter fails as intended, concrete, checkable proof the pilot needs before expanding beyond one team, not just an absence of complaints so far.
Trade-offs and pitfalls
Rolling out VPC Service Controls organization-wide before understanding which legitimate data flows currently cross what will become perimeter boundaries is the most common way such a rollout causes an unplanned outage, some legitimate integration nobody inventoried gets blocked. Treating IAP as sufficient zero-trust coverage on its own is another mistake, IAP only covers human access to the applications it fronts, service-to-service traffic and data-exfiltration risk still need the other two mechanisms. A third pitfall is picking a pilot team with a simple, low-boundary-crossing access pattern because it's easier, that produces a pilot that "succeeds" without ever really testing the parts of the design that matter.
Explain the difference between primitive, predefined, and custom IAM roles, and between service accounts and user accounts. How would you manage service account keys safely, and how would you present least-privilege guidance to a customer's engineering and security teams?
Sample Answer
Direct answer
Primitive, predefined, and custom roles are three levels of granularity for what a principal can do, from a project-wide blunt instrument, to a Google-curated service-scoped bundle, to a hand-assembled permission set. Service accounts and user accounts are a different axis entirely, who is asking: a user account represents a human tied to a person's identity, and a service account represents a non-human workload identity that code runs as. Least privilege in practice means picking the narrowest role granularity that actually covers the job, and it means eliminating the biggest concrete risk in this space: long-lived, downloadable service account keys.
The taxonomy, and the identity question underneath it
The three role types
Primitive roles (Owner, Editor, Viewer) are pre-IAM legacy roles applying project-wide with no resource-type granularity. Owner in particular can grant IAM permissions on itself, meaning an Owner can widen its own access later, that self-escalation risk is why primitive roles are discouraged outside small personal projects. Predefined roles are curated, per-service bundles, separating, for example, "can view Cloud SQL instances" from "can administer them" from "can only connect and query," and most real-world grants should live here. Custom roles are assembled from individual permissions when even the narrowest predefined role still over-grants, the cost is that custom roles do not automatically pick up new permissions as GCP services evolve the way predefined roles do, so they need periodic review or they silently drift, either under-granting as new capabilities appear or accumulating unused permissions.
Service accounts versus user accounts
A user account authenticates a specific person, typically through short-lived, login-mediated credentials a human re-establishes regularly. A service account authenticates a workload, a Compute Engine VM, a Cloud Run service, a CI/CD (continuous integration and continuous delivery) pipeline, and no human directly stands behind each individual authentication. Because nobody "logs in" as a service account the way a person logs in, its credentials tend to live longer and get embedded in code or configuration, which is exactly why they need more deliberate management than a human's login session does.
Managing service account keys safely
The safest key is the one that never exists: wherever a workload runs on Google infrastructure, Compute Engine, GKE, Cloud Run, Cloud Functions, attach the service account directly to the resource and let the platform hand out short-lived credentials automatically, no downloadable key file is ever created. Where an exported key truly cannot be avoided, an external system not running on GCP and not able to use workload identity federation (a mechanism that lets an external identity prove itself to Google Cloud directly and receive a short-lived credential, so no GCP key ever has to be created or stored on that system), treat it like a production secret: store it in Secret Manager rather than source control or a config file, rotate it on a schedule well under its maximum lifetime, and set an organization policy blocking new key creation by default so exceptions are deliberate and reviewable rather than a silent default. Audit existing keys periodically for age and last-used timestamp, a key nobody has used in months is pure liability with zero offsetting benefit, disable it.
Presenting this to engineering and security teams
To engineering, frame it as removing maintenance burden rather than adding a restriction, nobody enjoys rotating a JSON key file, and once set up, an attached service account with automatic credentials is strictly less work than managing a key. To security, frame it in terms of what a leaked credential can do and for how long, a downloaded key is a bearer credential usable from anywhere until someone notices and revokes it, while an attached-identity credential is short-lived and scoped to the resource, which dramatically narrows both the exposure window and the blast radius (how far the damage from that one leak can reach) of any leak.
Worked example
A batch job on a Compute Engine VM needs to write files to Cloud Storage. The naive setup downloads a service account key and bakes it into the VM's startup script or a config file, so that JSON file now exists on disk, inside a boot image, and possibly inside a config-management repository, three separate places it could leak from. The no-key setup instead attaches the service account directly to the VM and grants it only roles/storage.objectCreator, scoped to the one destination bucket, not roles/storage.admin on the whole project. The code calls the Cloud Storage client library with no credential file at all, the library picks up the attached identity automatically, and there is no key sitting anywhere for anyone to exfiltrate.
Trade-offs and pitfalls
Custom roles set up once and never revisited drift out of sync with what a workload actually needs as it evolves. Treating "we rotate keys quarterly" as sufficient without asking whether the key needs to exist at all confuses damage control with the actual fix, rotation limits exposure, elimination removes it entirely. Granting roles/iam.serviceAccountKeyAdmin broadly lets someone mint new keys for any service account, that permission itself deserves to be one of the most tightly held in a project. It is also worth naming honestly to an operations team that an org policy blocking key creation will break anything still assuming a downloadable key, this change needs an inventory pass first, not a switch flipped without warning.
Unlock Full Question Bank
Get access to all 15 Google Cloud Platform Services and Architecture interview questions and detailed answers.
Sign in to ContinueJoin thousands of developers preparing for their dream job.