CoreHRx Jobs

Apply in one click, save jobs and take free mock tests.

Register free Log in
Hiring? Post jobs with CoreHRx
My account
user

View & update profile
Interview guide

Google Cloud (GCP) Interview Questions and Answers: 60 Questions from Easy to Hard

This guide is for freshers in India preparing for cloud, support and DevOps roles, and for developers and cloud engineers with 1 to 10 years of experience facing Google Cloud interviews. It has 60 questions with answers in three levels: basics such as projects, IAM, regions, Compute Engine, Cloud Storage and Cloud Run; day-to-day work with GKE, Cloud SQL, BigQuery, Pub/Sub, load balancing and monitoring; and senior design questions on security, reliability and cost. Read each answer, explain it aloud in your own words, then take the mock test. The questions are written by CoreHRx for practice. CoreHRx is not affiliated with or endorsed by Google, and these are not actual Google Cloud certification exam questions. Google Cloud changes often, and names and defaults here are as of 2025, so check the official documentation.

Practice questions written by CoreHRx. CoreHRx is not affiliated with or endorsed by Google, and these are not actual Google Cloud certification exam questions.

What Google Cloud interviews cover

  • Foundations: the organization, folder and project hierarchy, regions and zones, billing accounts and the gcloud CLI.
  • Identity and access: IAM roles and inheritance, service accounts and impersonation, Workload Identity Federation and organization policies.
  • Compute and containers: Compute Engine VMs and managed instance groups, GKE Standard and Autopilot, Cloud Run and App Engine, and when to pick each.
  • Data and messaging: Cloud Storage classes and lifecycle rules, Cloud SQL high availability and replicas, BigQuery partitioning and cost, and Pub/Sub delivery semantics.
  • Networking and operations: VPC subnets and firewall rules, load balancing, Cloud NAT, Cloud Logging and Monitoring, security controls and cost control.

How to prepare (freshers and experienced)

  • Freshers: if you have a free trial or a training account, build one small project end to end, such as a Cloud Run API that reads from Cloud SQL and stores files in a Cloud Storage bucket.
  • Practise the commands for the services you mention (gcloud run deploy, gcloud compute instances create, bq query) and know what each flag does; interviewers trust candidates who can describe the exact step.
  • Draw the resource hierarchy and one request path on paper, from the user to the load balancer, the service and the database, because many interviews ask you to sketch one.
  • Experienced engineers: prepare two or three real stories, such as an outage you debugged, a cost you cut or a migration you led, with the numbers and the trade-offs.
  • Read Google Cloud architecture guidance on reliability, security and cost optimisation; senior design questions follow the same ideas closely.

Common mistakes and interview-day tips

  • Do not answer with a list of service names. Say what problem the service solves, what it costs you in operations, and when you would not use it.
  • Bring security in by default: least-privilege IAM, no service account keys, private IPs, and secrets in Secret Manager.
  • If you are not sure of a limit or a default, say so and explain how you would check the documentation; a confident wrong number hurts more than an honest answer.
  • In design questions, first ask about users, traffic, data size, budget and recovery targets, then choose services.
  • Google renames products often: Cloud Functions is now Cloud Run functions, and Artifact Registry replaced Container Registry. Use current names but recognise the old ones.

Google Cloud interview questions: Easy questions (freshers)

20 questions

1. What is the Google Cloud resource hierarchy, and why does it matter?

Google Cloud organises everything as organization, then folders, then projects, then resources such as VMs, buckets and datasets. The organization node comes from a Google Workspace or Cloud Identity domain, folders group projects by team or environment, and every resource belongs to exactly one project. It matters because IAM allow policies and organization policies set higher up are inherited by everything below. Granting a group Viewer on the Production folder gives read access to every project in it. A common mistake is putting dev and prod in one project, which mixes access and billing.

2. What is the difference between a project ID, a project name and a project number?

The project ID is the globally unique identifier you choose, such as hr-portal-prod-01. You use it in gcloud commands and API calls, and it cannot be changed after the project is created. The project name is only a display label; it need not be unique and can be edited at any time. The project number is assigned by Google and appears in places such as the default Compute Engine service account email and Workload Identity Federation paths. A common mistake is putting a client's name or the word test in a project ID, because the ID stays with the project for life.

Example
gcloud projects create hr-portal-prod-01 --name="HR Portal Prod"
gcloud config set project hr-portal-prod-01
gcloud projects describe hr-portal-prod-01 \
  --format="value(projectNumber)"

3. What are regions and zones, and how do you choose them for users in India?

A region is a geographic location, such as asia-south1 in Mumbai or asia-south2 in Delhi, and each region has several zones, such as asia-south1-a, which are separate failure domains. Zonal resources such as a VM or a zonal persistent disk live in one zone; regional resources such as a regional managed instance group, a Cloud Run service or a Cloud SQL HA instance span zones. For Indian users, pick an Indian region for low latency, and check data residency rules and that every service you need is offered there. Putting everything in one zone means one zone outage takes the app down.

4. What are basic, predefined and custom roles in IAM, and why should you avoid basic roles?

A role is a set of permissions, and you grant roles to principals on a resource. Basic roles (Owner, Editor and Viewer) are broad: Editor can change almost every resource in a project. Predefined roles are maintained by Google per service, such as roles/storage.objectViewer, which only lets someone read objects. Custom roles are your own list of permissions when no predefined role fits. Grant the smallest predefined role on the smallest scope, for example on one bucket instead of the whole project, and grant to Google groups rather than individuals so joiners and leavers are easy to handle.

Example
gcloud storage buckets add-iam-policy-binding gs://hr-payslips-prod \
  --member="group:hr-auditors@example.com" \
  --role="roles/storage.objectViewer"

5. What is a service account, and how is it different from a user account?

A service account is an identity for an application or workload rather than a person. A VM, a Cloud Run service or a GKE workload runs as a service account, and the IAM roles granted to it decide what the code can call, for example publishing to one Pub/Sub topic. It has an email such as orders-api@my-proj.iam.gserviceaccount.com and no password. Code running on Google Cloud gets short-lived tokens from the attached service account automatically, so no key file is needed. The classic mistake is downloading a JSON key and committing it to Git; leaked keys are a common cause of breaches.

6. How do you create a Compute Engine VM with gcloud, and what does each part of the command mean?

The command names the VM and sets where it runs and what it boots. Here web-1 is created in zone asia-south1-a with the e2-medium machine type, a small general-purpose shape. The image family debian-12 from the public project debian-cloud means the latest Debian 12 image, so you do not hard-code an image version. The network tag web lets firewall rules target this VM. By default the VM also gets an ephemeral external IP; production VMs often use --no-address and reach the internet through Cloud NAT, with SSH through IAP. Always choose the zone on purpose instead of accepting a default.

Example
gcloud compute instances create web-1 \
  --zone=asia-south1-a \
  --machine-type=e2-medium \
  --image-family=debian-12 \
  --image-project=debian-cloud \
  --tags=web

7. What is the difference between a persistent disk and a local SSD on Compute Engine?

A persistent disk, and the newer Hyperdisk, is network-attached block storage that exists independently of the VM: you can stop or delete the VM and keep the disk, grow it, take snapshots and attach it to another VM. A regional persistent disk replicates synchronously across two zones. A local SSD is physically attached to the host, so it is much faster, but it is ephemeral: its data is lost when the VM is deleted, and you cannot snapshot it. Use local SSD only for scratch data or caches you can rebuild, and keep databases on persistent disk or Hyperdisk.

8. What are the Cloud Storage storage classes, and when would you use each?

Cloud Storage has Standard, Nearline, Coldline and Archive. All four use the same API and give millisecond access; they differ in storage cost, retrieval cost and minimum storage duration: none for Standard, 30 days for Nearline, 90 days for Coldline and 365 days for Archive. Standard suits data read often, such as website images; Nearline suits data read about once a month, such as monthly reports; Coldline and Archive suit backups and compliance records. A common mistake is thinking Archive needs hours to restore like tape. It does not, but reading it often is expensive.

Example
gcloud storage buckets create gs://pune-hr-backups \
  --location=asia-south1 \
  --default-storage-class=COLDLINE \
  --uniform-bucket-level-access

9. What is Cloud Run, and what does a container need in order to run on it?

Cloud Run is a serverless platform that runs your container image and handles HTTPS, scaling and the servers underneath. A service scales out with traffic and can scale to zero when idle. The container must be stateless, listen for HTTP requests on the port given in the PORT environment variable (8080 by default) and start quickly. Its local file system is in memory and temporary, so files belong in Cloud Storage or a database. Cloud Run jobs handle run-to-completion work such as a nightly report. Common mistakes: hard-coding port 5000, or keeping user sessions in memory.

Example
gcloud run deploy orders-api \
  --image=asia-south1-docker.pkg.dev/my-proj/apps/orders-api:1.4.0 \
  --region=asia-south1 \
  --no-allow-unauthenticated

10. What is the difference between the App Engine standard and flexible environments?

App Engine is Google's original platform as a service: you deploy code with an app.yaml file and Google runs it. The standard environment runs supported language runtimes, starts instances in seconds and can scale to zero. The flexible environment runs your app in Docker containers on Compute Engine VMs, allows custom runtimes and background processes, but scales more slowly and always keeps at least one instance running. Each project has a single App Engine application, and its region cannot be changed after it is created. For new container workloads, many teams now choose Cloud Run instead.

Example
# app.yaml (standard environment)
runtime: python312
instance_class: F2
automatic_scaling:
  max_instances: 5

# deploy from the folder that holds app.yaml
gcloud app deploy

11. What is GKE, and how do Autopilot and Standard mode differ?

Google Kubernetes Engine is managed Kubernetes: Google runs the control plane, and you deploy workloads with kubectl or manifests. In Standard mode you create and manage node pools, choose machine types and pay for the nodes whether pods fill them or not. In Autopilot mode Google manages the nodes and applies hardened defaults, and you pay mainly for the CPU and memory your pods request. Autopilot suits teams that want Kubernetes without node operations; Standard suits workloads that need node-level control, such as special node settings. Autopilot clusters are always regional.

Example
gcloud container clusters create-auto orders-cluster \
  --region=asia-south1
gcloud container clusters get-credentials orders-cluster \
  --region=asia-south1
kubectl get nodes

12. What is Cloud SQL, and when would you use it instead of running MySQL on a VM?

Cloud SQL is a managed relational database service for MySQL, PostgreSQL and SQL Server. Google handles provisioning, patching, automated backups, point-in-time recovery, replication and high availability, while you handle schemas, queries, users and sizing. Choose it over your own VM when you want less operations work and standard engine features are enough. Self-manage on a VM only if you need an unsupported extension or version, or OS access. A common mistake is giving the instance a public IP with 0.0.0.0/0 in authorized networks; use private IP or the Cloud SQL Auth Proxy.

13. What is BigQuery, and how is it different from an application database like Cloud SQL?

BigQuery is a serverless data warehouse for analytics. It stores data by column and spreads each query over many workers, so it is fast at aggregating billions of rows, but it is not built for frequent single-row updates like an orders database. You load or stream data in and query it with GoogleSQL. With on-demand pricing you pay for the bytes a query reads, so selecting only the columns you need matters. Use Cloud SQL for an app's transactions and BigQuery for reports across the whole history, such as daily revenue per city below.

Example
SELECT city, COUNT(*) AS orders, SUM(amount) AS revenue
FROM shop.orders
WHERE DATE(order_ts) = '2026-10-31'
GROUP BY city
ORDER BY revenue DESC;

14. What are topics and subscriptions in Pub/Sub, and what is the difference between push and pull?

Publishers send messages to a topic, and each subscription on that topic gets its own copy of every message published after the subscription was created, so billing, email and analytics can each consume order events independently. With a pull subscription the subscriber asks for messages and acknowledges each one, which suits workers that control their own pace. With a push subscription Pub/Sub sends each message as an HTTPS request to an endpoint such as a Cloud Run service, and a success status code counts as the acknowledgement. Unacknowledged messages are redelivered.

Example
gcloud pubsub topics create order-events
gcloud pubsub subscriptions create billing-sub \
  --topic=order-events
gcloud pubsub topics publish order-events \
  --message='{"order_id": "A1001"}'

15. What is a VPC network in Google Cloud, and what is the difference between auto mode and custom mode?

A VPC network in Google Cloud is global: one network can have subnets in many regions, and VMs in different regions reach each other over Google's private network without extra setup. Subnets are regional, each with its own IP range. An auto mode network creates one subnet in every region from a fixed range, which is quick for learning but can clash with office or partner ranges later. A custom mode network has only the subnets you create, with ranges you plan, so it is the usual choice for production. You can expand a subnet's range later, but you cannot shrink it.

16. How do VPC firewall rules work in Google Cloud?

VPC firewall rules allow or deny traffic to and from VM network interfaces. They are stateful, so when an incoming connection is allowed, its replies are allowed automatically. Every network has two implied rules at the lowest priority: deny all ingress and allow all egress. Each rule has a priority from 0 to 65535, where a lower number wins, and can target all instances, instances with a network tag, or instances running as a given service account. The rule below lets only the office range reach port 443 on VMs tagged web. A common mistake is opening port 22 to 0.0.0.0/0 for SSH.

Example
gcloud compute firewall-rules create allow-office-https \
  --network=prod-vpc \
  --direction=INGRESS \
  --action=ALLOW \
  --rules=tcp:443 \
  --source-ranges=203.0.113.0/24 \
  --target-tags=web

17. What do Cloud Logging and Cloud Monitoring do, and how do they work together?

Cloud Logging collects and stores logs from Google Cloud services, your applications and VMs (through the Ops Agent), and lets you search them with the Logging query language, as in the filter below for errors from one Cloud Run service. Cloud Monitoring collects metrics such as CPU use, request count and latency, and provides dashboards, uptime checks and alerting policies that notify email, chat or paging channels. They connect through log-based metrics: a log pattern such as payment failures can become a metric you alert on. Cloud Run and GKE send stdout and stderr to Logging automatically.

Example
resource.type="cloud_run_revision"
resource.labels.service_name="orders-api"
severity>=ERROR

18. How does Google Cloud protect data at rest, and what is the shared responsibility model?

Google Cloud encrypts customer data at rest by default with keys that Google manages, so there is nothing to switch on. If you need control over the keys for audit or regulation, you can use customer-managed encryption keys (CMEK) in Cloud KMS. Google also encrypts data in transit when it leaves the physical boundaries Google controls. Under the shared responsibility model, Google secures data centres, hardware and the managed service infrastructure, while you own IAM, network exposure, your code, OS patching on your own VMs and how data is shared. Most incidents start on the customer side.

19. Does a budget in Google Cloud stop spending when the limit is reached?

No. A Cloud Billing budget tracks actual or forecast spend against an amount and sends alerts at thresholds you choose, such as 50, 90 and 100 percent, to billing admins or to a Pub/Sub topic. It does not cap usage or shut anything down by itself. To act automatically, a function can subscribe to the budget's Pub/Sub messages and, for example, scale a service down or disable billing on a sandbox project. Billing data also arrives with a delay, so a runaway job can overshoot before the alert fires. For hard limits on usage, use quotas, such as a custom daily BigQuery query quota.

20. What is the difference between gcloud auth login and gcloud auth application-default login?

gcloud auth login stores credentials that the gcloud CLI uses for its own commands. gcloud auth application-default login sets up Application Default Credentials (ADC) on your machine, which the Google Cloud client libraries in your Python, Java or Node.js code pick up automatically. On Google Cloud, ADC comes instead from the attached service account through the metadata server, so the same code works locally and in production without key files. A common mistake is running only the first command and then wondering why a local script says it could not find default credentials.

Example
gcloud init
gcloud auth login
gcloud auth application-default login
gcloud config set compute/region asia-south1
gcloud config list

Ready to check yourself? Take the free Google Cloud mock test

Google Cloud interview questions: Medium questions (1-3 years)

20 questions

21. What are Spot VMs, and which workloads are safe to run on them?

Spot VMs use spare Compute Engine capacity at a large discount, but Google can stop or delete them at any time when it needs the capacity back, with a preemption notice of up to 30 seconds. They have no minimum or maximum runtime, are not covered by the Compute Engine SLA and are not live-migrated. Use them for fault-tolerant, restartable work: batch rendering, CI runners, data processing that checkpoints, or extra GKE nodes beside regular ones. Do not run a single database or other stateful service on them. Design jobs so a preemption only repeats a small chunk of work.

Example
gcloud compute instances create render-1 \
  --zone=asia-south1-b \
  --machine-type=n2-standard-8 \
  --provisioning-model=SPOT \
  --instance-termination-action=DELETE

22. How do managed instance groups give you autoscaling and autohealing?

A managed instance group (MIG) creates identical VMs from an instance template. The autoscaler adds or removes VMs based on a signal such as CPU utilisation, load balancer serving capacity or a Monitoring metric, between the minimum and maximum you set. Autohealing uses a health check: if the application stops responding, the MIG recreates that VM. A regional MIG spreads VMs across zones. To ship a new version, create a new template and start a rolling update. A common mistake is an autohealing initial delay shorter than the app's boot time, which makes the group recreate VMs forever.

Example
gcloud compute instance-templates create web-tpl \
  --machine-type=e2-medium --tags=web \
  --image-family=debian-12 --image-project=debian-cloud \
  --metadata-from-file=startup-script=startup.sh

gcloud compute instance-groups managed create web-mig \
  --region=asia-south1 --template=web-tpl --size=2

gcloud compute instance-groups managed set-autoscaling web-mig \
  --region=asia-south1 --min-num-replicas=2 \
  --max-num-replicas=10 --target-cpu-utilization=0.6

23. How do you let engineers SSH into VMs that have no external IP address?

Use Identity-Aware Proxy (IAP) TCP forwarding. The engineer runs gcloud compute ssh with --tunnel-through-iap; IAP checks their Google identity and IAM permissions and forwards the connection over Google's network to the VM's internal IP. You need a firewall rule allowing port 22 only from the IAP range 35.235.240.0/20, and the user needs the IAP-secured Tunnel User role (roles/iap.tunnelResourceAccessor), plus OS Login roles if OS Login is enabled. This removes public SSH ports and bastion hosts, and with IAP Data Access audit logs on, each connection is recorded.

Example
gcloud compute firewall-rules create allow-iap-ssh \
  --network=prod-vpc --direction=INGRESS --action=ALLOW \
  --rules=tcp:22 --source-ranges=35.235.240.0/20

gcloud compute ssh web-1 --zone=asia-south1-a \
  --tunnel-through-iap

24. How do concurrency, minimum instances and CPU allocation affect a Cloud Run service's latency and cost?

Concurrency is how many requests one instance serves at the same time; the default is 80. Higher concurrency means fewer instances for the same traffic, but CPU-heavy or non-thread-safe code may need a low value, even 1. Minimum instances keep instances warm to avoid cold starts after idle periods, but you pay for them while idle. By default CPU is allocated only while a request is being processed, so background work after the response gets throttled; --no-cpu-throttling keeps CPU always allocated, under a different billing model. Startup CPU boost (--cpu-boost) shortens cold starts.

Example
gcloud run services update orders-api \
  --region=asia-south1 \
  --concurrency=40 \
  --min-instances=1 \
  --max-instances=30 \
  --cpu-boost

25. How do you do a canary release on Cloud Run?

Every deployment creates a new immutable revision, and you control how traffic is split between revisions. Deploy the new image with --no-traffic and a tag: the revision gets its own URL with the tag as a prefix but no user traffic. Test it there, then send a small share, such as 10 percent, to the tag, watch error rate and latency in Cloud Monitoring, and increase step by step. If something breaks, move all traffic back to the previous revision in seconds. A common mistake is a plain deploy on a service that serves the latest revision, which moves all traffic at once.

Example
gcloud run deploy orders-api --region=asia-south1 \
  --image=asia-south1-docker.pkg.dev/my-proj/apps/orders-api:1.5.0 \
  --no-traffic --tag=canary

gcloud run services update-traffic orders-api \
  --region=asia-south1 --to-tags=canary=10

gcloud run services update-traffic orders-api \
  --region=asia-south1 --to-latest

26. How should a Cloud Run service connect to a Cloud SQL database securely?

Avoid a public IP with open authorized networks. One good pattern is --add-cloudsql-instances, which gives the container a Unix socket under /cloudsql/ backed by the Cloud SQL Auth Proxy mechanism: connections are encrypted and authorised by IAM, and the service account needs the Cloud SQL Client role. The other is a private IP instance reached through Direct VPC egress or a Serverless VPC Access connector. Either way, keep the database password in Secret Manager or use IAM database authentication, and size the connection pool to what the instance can handle.

Example
gcloud run deploy orders-api --region=asia-south1 \
  --image=asia-south1-docker.pkg.dev/my-proj/apps/orders-api:1.5.0 \
  --service-account=orders-api@my-proj.iam.gserviceaccount.com \
  --add-cloudsql-instances=my-proj:asia-south1:orders-db \
  --set-secrets=DB_PASS=orders-db-pass:3

27. How do Object Lifecycle Management rules cut Cloud Storage cost? Explain the rules below.

Lifecycle rules make Cloud Storage change an object's storage class or delete it when conditions match, with no code. Here, objects still in Standard move to Coldline once they are 90 days old, and anything older than 365 days is deleted, which suits invoice PDFs read often in the first quarter and kept for a year. Check minimum storage durations before choosing a target class, because an early delete or move is still charged for the minimum. Actions run asynchronously, and a new configuration can take up to 24 hours to apply. For unpredictable access, Autoclass can manage the class instead.

Example
{
  "lifecycle": {
    "rule": [
      {
        "action": {"type": "SetStorageClass",
                   "storageClass": "COLDLINE"},
        "condition": {"age": 90,
                      "matchesStorageClass": ["STANDARD"]}
      },
      {
        "action": {"type": "Delete"},
        "condition": {"age": 365}
      }
    ]
  }
}

gcloud storage buckets update gs://invoices-prod \
  --lifecycle-file=rules.json

28. A Chennai edtech start-up wants students to download course PDFs without making the bucket public. What do you suggest?

Keep the bucket private, with uniform bucket-level access and public access prevention enforced, and let the backend create a signed URL for each download after checking the student's enrolment. A signed URL gives time-limited access to one object, for example 15 minutes, to whoever holds the link, with no Google account needed; V4 signing allows at most seven days. On Cloud Run, sign through the IAM signBlob API instead of a key file, which needs the Service Account Token Creator role on the signing service account. For heavy traffic, put Cloud CDN in front and use its signed URLs or cookies.

29. How do partitioning and clustering reduce BigQuery cost and time? Explain this table definition.

Partitioning splits the table into segments, here one per day of order_ts, so a query that filters on the date reads only the matching partitions. Clustering sorts data inside each partition by the clustering columns, here customer_id and city, so filters on them can skip blocks. On-demand, that means fewer bytes billed; with capacity pricing, fewer slots. require_partition_filter makes BigQuery reject any query on the table without a filter on the partition column, which stops accidental full scans. Partition on a column almost every query filters on, and avoid many tiny partitions.

Example
CREATE TABLE shop.orders (
  order_id STRING,
  customer_id STRING,
  city STRING,
  amount NUMERIC,
  order_ts TIMESTAMP
)
PARTITION BY DATE(order_ts)
CLUSTER BY customer_id, city
OPTIONS (require_partition_filter = TRUE);

30. An analyst ran SELECT * with LIMIT 10 on a 2 TB BigQuery table just to preview it, and the query was billed for the whole table. Why, and how do you prevent it?

BigQuery stores data by column, and on-demand queries are billed for the bytes read from every column they reference. LIMIT only trims the result after the data is read, so SELECT * with LIMIT 10 on an unclustered table still reads every column of the table. To look at sample rows, use the table preview in the console or bq head, which are free. Before running a real query, a dry run reports the bytes it would process, and maximum bytes billed makes a query fail, without charge, if it would read more. Select only the needed columns and filter on partitions.

Example
bq query --use_legacy_sql=false --dry_run \
  'SELECT city, SUM(amount) FROM shop.orders
   WHERE DATE(order_ts) = "2026-10-31" GROUP BY city'

bq query --use_legacy_sql=false \
  --maximum_bytes_billed=10000000000 \
  'SELECT city, SUM(amount) FROM shop.orders
   WHERE DATE(order_ts) = "2026-10-31" GROUP BY city'

bq head --max_rows=10 shop.orders

31. Your Pub/Sub subscriber sometimes processes the same order twice. Why does this happen, and how do you fix it?

Pub/Sub delivers at least once by default, so duplicates are expected: a message is redelivered if it is not acknowledged within the ack deadline, if the ack is lost, or after a subscriber crash. Processing that runs past the deadline is the usual cause, so raise the ack deadline or let the client library extend leases, and ack only after the work is committed. Make the handler idempotent, for example by recording the order ID under a unique key and skipping repeats. Add a dead-letter topic so a message that keeps failing is set aside after a few attempts instead of looping.

Example
gcloud pubsub subscriptions update billing-sub \
  --ack-deadline=120 \
  --dead-letter-topic=order-events-dlq \
  --max-delivery-attempts=5

32. How do you make Pub/Sub deliver the messages for one customer in order?

Publish with an ordering key, such as the customer ID, enable message ordering in the publisher client, and create the subscription with message ordering enabled. Pub/Sub then delivers messages that share a key, published in the same region, in the order it received them, while different keys are still processed in parallel. If a publish for a key fails, the client pauses that key until you resume it, so no gap appears. Ordering does not remove duplicates, and a redelivery also resends the later messages for that key, so handlers must stay idempotent. One key for all messages kills throughput.

Example
gcloud pubsub subscriptions create ledger-sub \
  --topic=order-events \
  --enable-message-ordering

gcloud pubsub topics publish order-events \
  --message='{"order_id": "A1002"}' \
  --ordering-key=CUST-42

33. What is the difference between Cloud SQL high availability and read replicas?

High availability (HA) gives you a primary and a standby in two zones of the same region, with storage replicated synchronously. If the primary's zone fails, Cloud SQL fails over to the standby automatically and the instance keeps its IP and connection name, so apps just reconnect. The standby cannot serve reads. A read replica is a separate instance updated asynchronously; it serves read-only traffic such as reports, can live in another region, and can be promoted manually for disaster recovery. Replicas can lag, so never read a value from a replica right after writing it to the primary.

Example
gcloud sql instances create orders-db \
  --database-version=POSTGRES_16 \
  --edition=ENTERPRISE \
  --tier=db-custom-2-7680 \
  --region=asia-south1 \
  --availability-type=REGIONAL

gcloud sql instances create orders-db-read \
  --master-instance-name=orders-db \
  --region=asia-south1

34. How would you set up a pipeline that builds a container and deploys it to Cloud Run on every commit?

Connect the repository to a Cloud Build trigger on the main branch. The cloudbuild.yaml builds the image, pushes it to Artifact Registry tagged with the commit SHA, and deploys that exact image to Cloud Run. Tagging with the SHA instead of latest makes every revision traceable and easy to roll back. The build's service account needs Cloud Run Admin, Artifact Registry Writer, and Service Account User on the runtime service account. Add tests and a vulnerability scan as earlier steps, and gate production behind an approval or a separate trigger.

Example
steps:
  - name: gcr.io/cloud-builders/docker
    args: ['build', '-t',
      'asia-south1-docker.pkg.dev/$PROJECT_ID/apps/orders:$SHORT_SHA',
      '.']
  - name: gcr.io/cloud-builders/docker
    args: ['push',
      'asia-south1-docker.pkg.dev/$PROJECT_ID/apps/orders:$SHORT_SHA']
  - name: gcr.io/google.com/cloudsdktool/cloud-sdk
    entrypoint: gcloud
    args: ['run', 'deploy', 'orders', '--region=asia-south1',
      '--image=asia-south1-docker.pkg.dev/$PROJECT_ID/apps/orders:$SHORT_SHA']

35. What are the parts of a global external Application Load Balancer, and how does a request flow through them?

The client reaches one global anycast IP, held by a forwarding rule, at the Google edge nearest the user. The forwarding rule points to a target HTTPS proxy, which ends TLS with a Google-managed or uploaded certificate. The proxy uses a URL map to choose a backend service or backend bucket by host and path, for example /api to Cloud Run and /static to a bucket. A backend service holds backends such as instance groups, network endpoint groups or serverless NEGs, a health check for VM backends, and optional Cloud CDN and Cloud Armor. Traffic goes to the nearest healthy backend with capacity.

36. Your load balancer returns 502 errors and the console shows every VM backend as unhealthy. What do you check?

First the firewall: health check probes come from 35.191.0.0/16 and 130.211.0.0/22, and without a rule allowing them to the serving port, every backend looks unhealthy. Second the health check itself: the right port, protocol and path, and that path must return 200 quickly without a login. Third, the instance group's named port must match the port name in the backend service. Then confirm the app listens on all interfaces, not only 127.0.0.1, and read the VM's logs. Health check logging records why a backend changed state.

Example
gcloud compute firewall-rules create allow-lb-health-checks \
  --network=prod-vpc --direction=INGRESS --action=ALLOW \
  --rules=tcp:8080 \
  --source-ranges=35.191.0.0/16,130.211.0.0/22 \
  --target-tags=web

37. How would you get alerted when payment failures spike in a Cloud Run service?

Write structured JSON logs with a severity and a field such as event set to payment_failed, so filters match reliably. Create a log-based counter metric from that filter, then an alerting policy in Cloud Monitoring on its rate, for example more than 20 failures in 5 minutes, routed to the on-call channel. Better still, alert on the failure ratio against total payments, so a traffic spike alone does not page anyone. Add documentation to the alert with first steps. A common mistake is free-text log lines that change wording between releases, which silently breaks the filter.

Example
gcloud logging metrics create payment_failures \
  --description="Failed payments in orders-api" \
  --log-filter='resource.type="cloud_run_revision"
    AND resource.labels.service_name="orders-api"
    AND jsonPayload.event="payment_failed"'

38. Why should application secrets live in Secret Manager instead of a deploy script, and how do you use it?

Values in deploy scripts or plain environment variables end up in Git history, CI logs and the service configuration, visible to anyone with view access. Secret Manager stores each secret with versions, encrypts it, controls access per secret with IAM (the runtime service account gets Secret Manager Secret Accessor only on the secrets it needs) and records access in audit logs. Cloud Run exposes a secret as an environment variable or a file. Pin a version for environment variables, because they are read only when an instance starts; rotation then means adding a version and redeploying.

Example
gcloud secrets create orders-db-pass \
  --replication-policy=automatic
gcloud secrets versions add orders-db-pass --data-file=pass.txt

gcloud secrets add-iam-policy-binding orders-db-pass \
  --member="serviceAccount:orders-api@my-proj.iam.gserviceaccount.com" \
  --role="roles/secretmanager.secretAccessor"

39. How do pods in GKE call Google Cloud APIs without service account key files?

Use Workload Identity Federation for GKE. The cluster joins a workload identity pool named PROJECT_ID.svc.id.goog, and each Kubernetes service account in a namespace becomes a principal IAM understands. Either grant IAM roles to that principal directly, or, as below, let it act as a Google service account through roles/iam.workloadIdentityUser and annotate the Kubernetes service account. Pods using it get short-lived tokens from the GKE metadata server. This beats JSON keys in Kubernetes secrets, which are long-lived and leak. Autopilot enables it by default; Standard needs it turned on.

Example
gcloud iam service-accounts add-iam-policy-binding \
  reports@my-proj.iam.gserviceaccount.com \
  --role=roles/iam.workloadIdentityUser \
  --member="serviceAccount:my-proj.svc.id.goog[billing/reports-ksa]"

kubectl annotate serviceaccount reports-ksa --namespace=billing \
  iam.gke.io/gcp-service-account=reports@my-proj.iam.gserviceaccount.com

40. How do you find out which team or service is driving the Google Cloud bill?

Label resources consistently, for example team and env, and turn on Cloud Billing export to BigQuery. The export has a row per usage line with service, SKU, project, labels, cost and credits, so you can group spend any way and build a dashboard on it. The query below sums October 2026 cost by team label. Remember that cost excludes credits such as sustained use and committed use discounts, which sit in a separate credits array, and that resources without a team label drop out of this join, so report unlabelled spend separately. Enforce labels in Terraform or CI.

Example
SELECT
  l.value AS team,
  service.description AS service,
  ROUND(SUM(cost), 2) AS cost
FROM `billing.gcp_billing_export_v1_XXXXXX`,
  UNNEST(labels) AS l
WHERE l.key = 'team'
  AND invoice.month = '202610'
GROUP BY team, service
ORDER BY cost DESC;

Ready to check yourself? Take the free Google Cloud mock test

Google Cloud interview questions: Hard questions (experienced)

20 questions

41. Design a highly available web application on Google Cloud for an Indian payments start-up that must survive the loss of a whole region.

Agree the RPO and RTO first. Run stateless app tiers in asia-south1 and asia-south2 behind one global external Application Load Balancer with Cloud Armor: MIGs with health checks, or Cloud Run through serverless NEGs with outlier detection, since serverless NEGs have no health checks. The data tier decides the rest: Spanner with a multi-region configuration gives synchronous replication and automatic failover, while Cloud SQL with a cross-region replica is cheaper but loses recent writes and needs a promotion. Keep sessions out of instances, use Terraform and rehearse failover.

42. IAM is already tight, so why would a bank add VPC Service Controls, and what can go wrong when you roll them out?

IAM answers who may call an API; VPC Service Controls add where data may go. A service perimeter around projects blocks Google APIs such as BigQuery and Cloud Storage from being used across its boundary, so even someone with valid IAM access, or a stolen credential, cannot copy a dataset into a project outside the perimeter or read it from an unapproved network. Access levels and ingress or egress rules allow the approved exceptions. The rollout risk is breaking legitimate flows, such as CI or a partner integration, so start in dry-run mode, study the violation logs and only then enforce.

43. When would you choose Shared VPC over VPC Network Peering, and which limitation of peering often surprises teams?

Shared VPC lets one host project own the network, subnets, firewall rules and hybrid connectivity, while service projects for each team run VMs, GKE clusters or serverless egress in the shared subnets. It suits one organisation wanting central network control with per-project billing and IAM; teams get the Compute Network User role on specific subnets. Peering joins two separate VPC networks, often across organisations, with each side keeping its own admin. The surprise is that peering is not transitive: if A peers with B and B with C, A cannot reach C through B. Peered ranges cannot overlap.

44. How do you let a GitHub Actions pipeline deploy to Google Cloud without storing a service account key?

Use Workload Identity Federation. Create a workload identity pool and an OIDC provider that trusts GitHub's token issuer, map claims such as the repository to attributes, and set an attribute condition so only your repository is accepted. Then grant that repository's principal set Workload Identity User on a deploy service account, or roles directly. Each run swaps GitHub's short-lived OIDC token for a short-lived Google token, so no long-lived secret exists to leak. Without the condition, any GitHub repository could use your provider, and a broad pool binding would let it in.

Example
gcloud iam workload-identity-pools create github-pool \
  --location=global --display-name="GitHub Actions"

MAP="google.subject=assertion.sub"
MAP="$MAP,attribute.repository=assertion.repository"
gcloud iam workload-identity-pools providers create-oidc github \
  --location=global --workload-identity-pool=github-pool \
  --issuer-uri="https://token.actions.githubusercontent.com" \
  --attribute-mapping="$MAP" \
  --attribute-condition="assertion.repository=='example-org/payroll-api'"

45. A contractor was given roles/editor on a folder. The project owner removed the contractor from the project's IAM policy, but the access remains. Why, and what are the right controls?

IAM allow policies are inherited down the hierarchy, and the effective policy is the union of all of them. A role granted on the folder applies to every project inside it, so removing a binding at the project changes nothing; the grant must be removed where it was made. A lower level cannot subtract a permission with an allow policy. To block permissions regardless of grants, use IAM deny policies on the organization, folder or project, which are evaluated before allow policies. Organization policies restrict configurations, such as service account key creation, not people.

46. Why is granting the Service Account User role at the project level a privilege-escalation risk?

roles/iam.serviceAccountUser includes iam.serviceAccounts.actAs, which lets a principal attach a service account to a VM, Cloud Run service or Cloud Build job they create. The code then runs with that service account's roles. Granted on the project, it covers every service account in it, so a developer allowed to deploy could attach a highly privileged account and gain its permissions indirectly. Grant it on individual service accounts, keep powerful accounts in separate projects and review with Policy Analyzer. Treat Service Account Token Creator, which allows impersonation, the same way.

47. How do you keep a production GKE cluster upgraded without causing outages?

Enrol the cluster in a release channel, such as Stable for production with staging on a faster channel so it gets each version first. Set maintenance windows in quiet hours and exclusions around sale events. For nodes, use surge upgrades tuned with maxSurge and maxUnavailable, or blue-green node pool upgrades for a quick rollback. Protect apps with several replicas spread across zones, readiness probes and PodDisruptionBudgets, remembering that GKE honours a PDB only for a limited time during a drain. Check deprecation insights for removed Kubernetes APIs before minor version upgrades.

48. In GKE, how do pod resource requests affect cost and reliability differently in Autopilot and Standard mode?

Requests drive scheduling in both modes. In Autopilot you pay for what pods request, so oversized requests cost money directly; undersized ones hurt reliability, since CPU above the limit is throttled and memory above the limit gets the container OOM-killed. In Standard you pay for nodes, so the waste shows up as half-empty nodes, and the cluster autoscaler adds nodes when pending pods cannot be scheduled based on requests, not on real usage. In both, set requests from measured usage (Vertical Pod Autoscaler recommendations help), scale replicas with HPA, and always set requests.

49. How do you decide between Cloud Run, GKE, App Engine and Compute Engine for a new service?

Start from the workload and the team. Cloud Run fits stateless HTTP services, event handlers and jobs: no clusters, scale to zero and the least operations. GKE fits a platform of many services that need Kubernetes features such as stateful sets, custom scheduling, service meshes or portability, run by a team that can own the cluster. Compute Engine fits software that needs a full OS, licensed or legacy apps, or long-running stateful processes. App Engine mostly runs existing apps; new ones usually go to Cloud Run. A sound default: start on Cloud Run, move when a concrete need appears.

50. A BigQuery dashboard query became slow and expensive as the table grew. How do you investigate and fix it?

Open the job's execution details to see bytes processed, slot time and the slowest stage, often a large join, a skewed key or a big shuffle. Then fix the cause: read only needed columns, filter early on the partition column by comparing it directly with constants so pruning works, and cluster on common filter or join keys. For dashboards that ask the same question all day, pre-aggregate with a materialized view or a scheduled summary table, and consider BI Engine. For heavy, predictable workloads, compare on-demand pricing with capacity-based editions and reservations.

Example
-- prunes to October partitions: the column is compared
-- directly with constant timestamps
SELECT city, SUM(amount) AS revenue
FROM shop.orders
WHERE order_ts >= TIMESTAMP('2026-10-01')
  AND order_ts < TIMESTAMP('2026-11-01')
GROUP BY city;

51. A regulated client wants customer-managed encryption keys for BigQuery and Cloud Storage. How does CMEK work, and what risks does it add?

With CMEK, Google still encrypts the data, but the key protecting the data encryption keys is a Cloud KMS key you own. You grant each service's service agent the CryptoKey Encrypter/Decrypter role on the key and set it as the default on a dataset or bucket; the key's location must match the data's location. You control rotation, can disable the key to cut off access, and key use is audited. The risk: disabling or destroying the key makes the data unreadable, and once the scheduled destruction period ends the key cannot be restored. Keep keys in a separate project with tight IAM.

Example
gcloud kms keyrings create data-keys \
  --location=asia-south1 --project=sec-keys
gcloud kms keys create payroll-key --keyring=data-keys \
  --location=asia-south1 --project=sec-keys \
  --purpose=encryption --rotation-period=90d \
  --next-rotation-time=2026-12-01T00:00:00Z

KEY=projects/sec-keys/locations/asia-south1/keyRings/data-keys
KEY=$KEY/cryptoKeys/payroll-key
gcloud storage buckets update gs://payroll-exports \
  --default-encryption-key=$KEY

52. Design an order-event pipeline from Pub/Sub to BigQuery that must never double-count revenue. Where can duplicates appear, and how do you handle them?

Duplicates can appear at three points: a publisher retries after a timeout and publishes twice, Pub/Sub redelivers under at-least-once delivery, and a consumer writes to the sink twice after a crash. Give every event a business ID at the source. Pub/Sub exactly-once delivery (pull subscriptions only, within a region) stops redelivery of acknowledged messages but not publisher duplicates. Dataflow can deduplicate on an ID attribute and write through the BigQuery Storage Write API in exactly-once mode, and final tables can MERGE on the event ID. Test by replaying messages with Pub/Sub seek.

53. During a sale, Cloud Run scaled to 50 instances and Cloud SQL started refusing connections. Explain the cause and the fix.

Each Cloud Run instance keeps its own connection pool, so total connections are instances multiplied by pool size: 50 instances with a pool of 10 can open 500 connections, which can exceed the database's max_connections and its memory. Fixes: cap --max-instances, shrink the per-instance pool and raise concurrency so fewer instances serve the load, put a pooler such as PgBouncer in between (or Cloud SQL managed connection pooling where your edition supports it), and move read-heavy endpoints to replicas or a Memorystore cache. Load-test sale traffic beforehand.

54. When would you move from Cloud SQL to AlloyDB or Spanner?

Cloud SQL scales vertically plus read replicas, which covers most applications. Choose AlloyDB for PostgreSQL when you need PostgreSQL compatibility with higher transactional throughput, read pools and its columnar engine for analytical queries on live data. Choose Spanner when writes outgrow a single primary, or you need horizontal scaling with strong consistency across regions and very high availability. Spanner speaks SQL, but you must design primary keys to avoid hotspots, for example not a sequential order ID. Either move costs migration effort, so measure the real bottleneck first.

55. What is your disaster recovery plan for a Cloud SQL database if the whole Mumbai region becomes unavailable?

Define RPO and RTO first. Keep a cross-region read replica in asia-south2; replication is asynchronous, so writes not yet replicated can be lost. In a disaster, promote the replica to a standalone primary, point the application at it through a DNS name or config value you can switch quickly, and rebuild replication later. Also keep automated backups with point-in-time recovery and regular exports to a bucket in another region, because replicas faithfully copy logical corruption such as a bad DELETE. Enterprise Plus adds managed DR options; check the docs. Rehearse the failover regularly.

Example
gcloud sql instances create orders-db-dr \
  --master-instance-name=orders-db \
  --region=asia-south2

# during a disaster: make the replica a standalone primary
gcloud sql instances promote-replica orders-db-dr

56. Private VMs must download OS patches, call a partner bank's API that allowlists source IPs, and read Cloud Storage. How do you design their egress?

Give the instances no external IPs. Enable Private Google Access on the subnet so they reach Google APIs such as Cloud Storage without public IPs; inside a VPC Service Controls perimeter, send that traffic to restricted.googleapis.com. Add Cloud NAT on a Cloud Router for internet egress and give it reserved static IPs through manual NAT IP assignment, so the bank can allowlist exactly those addresses. If only certain domains are allowed, enforce that with Secure Web Proxy or firewall policies. Monitor NAT port allocation and dropped connections.

Example
gcloud compute addresses create nat-ip-1 --region=asia-south1
gcloud compute routers create nat-router \
  --network=prod-vpc --region=asia-south1
gcloud compute routers nats create prod-nat \
  --router=nat-router --region=asia-south1 \
  --nat-all-subnet-ip-ranges \
  --nat-external-ip-pool=nat-ip-1
gcloud compute networks subnets update app-subnet \
  --region=asia-south1 --enable-private-ip-google-access

57. Bots are hammering the login endpoint of an app behind a global external Application Load Balancer. How do you protect it?

Attach a Cloud Armor security policy to the backend service and add a rate-limiting rule for the login path keyed on client IP, as below: up to 100 requests per minute per IP pass and the excess gets HTTP 429. Add preconfigured WAF rules for SQL injection and XSS, deny rules for known bad ranges, and reCAPTCHA-based bot management for smarter challenges. Start new rules in preview mode and read the logs before enforcing. Many real users can share one IP behind an office or mobile carrier NAT, so set thresholds with that in mind or key on a header or session.

Example
gcloud compute security-policies rules create 1000 \
  --security-policy=web-policy \
  --expression="request.path.matches('/login')" \
  --action=throttle \
  --rate-limit-threshold-count=100 \
  --rate-limit-threshold-interval-sec=60 \
  --conform-action=allow \
  --exceed-action=deny-429 \
  --enforce-on-key=IP

58. How do you set up SLO-based alerting for an API, and why is burn-rate alerting better than a fixed error-rate threshold?

Choose an SLI users feel, such as the share of requests served successfully within 500 ms, and an SLO such as 99.9 percent over 30 days. The error budget is the remaining 0.1 percent, about 43.2 minutes of full outage in 30 days. Burn rate is how fast you spend it: a burn rate of 1 uses the budget exactly over 30 days, while 14.4 sustained for an hour uses 2 percent of it. Cloud Monitoring lets you define SLOs on services and alert on burn rate. Page on a high burn over short windows and open a ticket for a slow burn over long ones, so alerts track real user impact.

59. How would you design central log storage and auditing for an organization with 60 projects?

Create an aggregated sink at the organization or folder with include-children, routing audit logs to a log bucket or BigQuery dataset in a dedicated security project that only the security team can read, and grant the sink's writer identity access on that destination. Admin Activity audit logs are always on and cannot be disabled. Data Access audit logs are off by default for most services except BigQuery, so enable them selectively, for example on buckets holding PII, because they add volume and cost. Exclude noisy logs such as health checks and set retention to match legal requirements.

Example
gcloud logging sinks create org-audit-sink \
  bigquery.googleapis.com/projects/sec-logs/datasets/org_audit \
  --organization=123456789012 \
  --include-children \
  --log-filter='logName:"cloudaudit.googleapis.com"'

60. A Hyderabad SaaS company's Google Cloud bill has grown fast. What would you do in the first month to cut it without hurting reliability?

Start with visibility: billing export to BigQuery, consistent labels and a per-team dashboard, so you know the top services and projects. Then the quick wins: delete idle resources such as unattached disks, unused static IPs, old snapshots and forgotten test projects; rightsize VMs and GKE requests using Recommender; and let autoscalers and Cloud Run scale down at night. Next, buy committed use discounts only for the steady baseline left after rightsizing, move batch work to Spot VMs, and apply storage lifecycle rules and BigQuery partitioning. Then set budget alerts and review monthly.

Practice questions for November 2026

New every month

3 questions from the Google Cloud mock test, the way they appear in it. A new set comes on the 1st of every month. Pick your answer, then open it.

  1. FresherCompute Engine

    Which statement about a zonal persistent disk is true?

    • Its data is wiped every time the VM is stopped and then started again
    • It can be attached to a VM in any region without being copied first
    • Its data survives a VM stop, and it can be attached to another VM in the same zone
    • It sits physically inside the host server, the same way as Local SSD
    Show the answer

    Answer: Its data survives a VM stop, and it can be attached to another VM in the same zone. Persistent disks are network block storage kept apart from the VM host, so data survives stop and start, and a disk can be detached and attached to another VM in its zone. Local SSD is the option that is physically attached to the host.

  2. Intermediate (1-5 years)Cloud Storage

    A bucket has this lifecycle configuration. What happens?

    {
        "lifecycle": {
            "rule": [{
                "action": {"type": "Delete"},
                "condition": {"age": 30, "matchesPrefix": ["tmp/"]}
            }]
        }
    }
    • Objects whose names start with tmp/ are deleted at 30 days old
    • Objects under tmp/ are deleted 30 days after they were last read
    • Every object in the bucket is deleted 30 days after it is created
    • Objects under tmp/ are moved to Nearline once they are 30 days old
    Show the answer

    Answer: Objects whose names start with tmp/ are deleted at 30 days old. A rule acts when all its conditions match: age counts days since the object was created and matchesPrefix limits it to names starting with tmp/. Lifecycle actions run asynchronously, so a delete can happen some time after day 30.

  3. Experienced (5+ years)GKE

    Network policy enforcement is on in a GKE cluster, but no NetworkPolicy objects exist yet. Which Pod traffic is allowed?

    • All of it, until some policy selects the Pods
    • No traffic at all, until some policy allows it
    • Only traffic between Pods on the same node
    • Only DNS traffic to the kube-dns Pods
    Show the answer

    Answer: All of it, until some policy selects the Pods. NetworkPolicies are additive allow lists: a Pod that no policy selects accepts everything. Once a policy selects a Pod for ingress, only traffic matching some policy is allowed, so teams add a default-deny policy in each namespace.

Take the full Google Cloud mock test

Ready to apply?

There are 2,079 open jobs asking for Google Cloud on CoreHRx right now. Create a free profile once and apply with it.