Choosing Compute: GCE, GKE, Cloud Run, Cloud Functions
Google ACE ACE · Planning and implementing a cloud solution
The compute decision
Google Cloud offers four main ways to run application code, and choosing between them is one of the most tested skills on the ACE exam. The options form a spectrum from most control to least management: Compute Engine (virtual machines you manage yourself), Google Kubernetes Engine (managed Kubernetes for containers), Cloud Run (managed containers that scale to zero), and Cloud Functions (single-purpose functions triggered by events). There is no universally best choice — the right answer depends on the workload's shape, and the exam tests whether you can match the workload to the service.
The decision usually turns on a few questions. Does the workload need a specific operating system or long-running state? That points to Compute Engine. Is it a containerized application with complex orchestration needs, multiple services, or custom networking? That points to GKE. Is it a containerized web service or API that should scale automatically, including down to zero when idle? That points to Cloud Run. Is it a short piece of code that runs in response to an event — a file uploaded to Cloud Storage, a message on Pub/Sub? That points to Cloud Functions. When a question describes a workload, look for these signals before looking at the options.
Compute Engine
Compute Engine provides virtual machines (VMs) running on Google's infrastructure. You choose the machine type (how many vCPUs and how much memory), the operating system image, the disks, and the network settings, and you manage the OS yourself — patching, configuration, and scaling. Compute Engine is the right choice when you need full control: custom kernels, licensed software that requires a specific OS, legacy applications that cannot be containerized, or workloads with special hardware needs such as GPUs or TPUs. It is also the choice when an application must run continuously with predictable performance. The trade-off is operational effort: you own the machine, including its maintenance.
Two cost features matter for the exam. Spot VMs are spare capacity sold at a deep discount (60–91% off regular prices) with one catch: Google can reclaim them at any time with a 30-second warning. They suit fault-tolerant, interruptible workloads — batch processing, rendering, data analysis jobs that can checkpoint and resume — and they are the wrong choice for anything that must stay up. Custom machine types let you choose an exact vCPU and memory combination instead of picking from predefined machine types, which saves money when a workload needs an unusual ratio (lots of memory, few CPUs, for example). Predefined machine types come in families optimized for different needs: general-purpose (N2, N2D, E2), compute-optimized (C3, C2), memory-optimized (M3, M2), and accelerator-optimized (G2, A3) for GPUs.
Google Kubernetes Engine
Google Kubernetes Engine (GKE) is Google's managed Kubernetes service: you deploy containerized applications, and GKE manages the control plane while you manage (or, with Autopilot, mostly avoid managing) the nodes. GKE is the right choice for containerized applications that need Kubernetes features — service discovery, rolling updates, horizontal pod autoscaling, complex networking, or multi-service architectures — and for teams that already run Kubernetes or need portability across clouds. GKE comes in two modes: Standard, where you configure and manage node pools yourself, and Autopilot, where Google manages the nodes, applies security hardening, and bills you for the pod resources you request rather than the nodes underneath. Autopilot is simpler and is usually the better recommendation for a team that wants Kubernetes without the operational overhead.
Cloud Run and Cloud Functions
Cloud Run is a fully managed platform for running containers: you provide a container image, and Google handles the infrastructure, scaling, and HTTPS endpoints. It scales automatically from zero to thousands of instances based on traffic, and you pay only for the CPU and memory your containers actually use while handling requests (plus a small charge for idle instances if you set a minimum). Cloud Run is the best fit for containerized web services, APIs, and microservices where you want serverless simplicity but need the flexibility of a container — any language, any runtime, any binary. Its limits matter for the exam: a request can run for at most 60 minutes, and each container instance handles one request at a time by default (configurable up to 1,000 concurrent requests per instance).
Cloud Functions (the 2nd generation runs on Cloud Run infrastructure) is for single-purpose functions: small units of code that run in response to an event. A function that resizes an image when it is uploaded to Cloud Storage, or processes a message from Pub/Sub, is the classic use case. Functions are simpler than Cloud Run services — you deploy code, not a container — but they are also more constrained: they are short-lived, stateless, and designed around one trigger. When a question describes an event-driven task with no need for a container or a web server, Cloud Functions is the answer; when it describes a web service or API, Cloud Run is.
Comparing the options
| Service | You manage | Best for | Scaling |
|---|---|---|---|
| Compute Engine | OS, patching, scaling | Full control, legacy apps, GPUs, custom OS | Manual or managed instance groups |
| GKE | Pods and workloads (Autopilot) or nodes too (Standard) | Container orchestration, microservices, portability | Node and pod autoscaling |
| Cloud Run | Just the container | Containerized web services and APIs | Automatic, to zero |
| Cloud Functions | Just the code | Short event-driven tasks | Automatic, to zero |
A useful exam heuristic: the more the question emphasizes "no server management" and "scale to zero", the further toward Cloud Run and Cloud Functions the answer lies. The more it emphasizes control, customization, or existing Kubernetes investment, the further toward GKE and Compute Engine. And whenever the workload is described as fault-tolerant batch work with a tight budget, Spot VMs should be in the answer.
Cost levers and machine families
Two pricing mechanisms apply across Compute Engine and GKE and are worth knowing for cost questions. Committed use discounts reduce prices substantially — up to 57% for most Compute Engine machine types, depending on the term — in exchange for committing to a level of usage for one or three years. They suit steady, predictable workloads where the commitment is safe. Sustained use discounts apply automatically to Compute Engine VMs: the more a VM runs during a month, the lower its effective hourly price, with no commitment required. Neither mechanism applies to serverless services, which bill only for what they use — the cost lever there is scaling to zero, not commitment. When a question asks how to reduce the cost of a workload that runs continuously, committed use discounts are usually part of the answer; when it runs intermittently, serverless or Spot VMs are.
Machine type families are the other planning detail. General-purpose families (E2, N2, N2D) balance CPU and memory for ordinary workloads and are the default choice. Compute-optimized families (C2, C3) offer the highest performance per core for CPU-hungry work such as batch processing, gaming servers, and high-performance computing. Memory-optimized families (M2, M3) provide very large memory per core for in-memory databases and analytics. Accelerator-optimized families (A3, G2) attach GPUs or TPUs for machine learning and graphics. The exam rarely asks you to name a family from memory, but it does test the mapping: a question describing a memory-hungry database should point you to memory-optimized, and one describing a GPU workload to accelerator-optimized. When in doubt, general-purpose is the safe default — and a custom machine type is the answer when the workload's ratio does not match any family.
Exam traps to watch for
- Recommending Cloud Functions for a long-running web service: functions are short-lived and event-driven; Cloud Run is for web services.
- Recommending Spot VMs for anything that must stay up: Google can reclaim them with 30 seconds of warning.
- Choosing GKE Standard when Autopilot would do: Autopilot removes node management and is the simpler recommendation unless the question needs custom node configuration.
- Forgetting that Cloud Run scales to zero and bills only for request-handling time — it is the cheapest option for spiky or idle-prone traffic.
Practice questions
Test yourself on this guide. Answers are checked instantly, with a full explanation for each question.
Q1.A company wants to run a containerized REST API that receives unpredictable traffic — sometimes thousands of requests per minute, sometimes none for hours. They want no server management and to pay only for what they use. Which service is the best fit?
Explanation: Cloud Run is designed for exactly this: containerized web services that scale automatically to zero when idle, with billing only for request-handling time. Compute Engine would require managing VMs and paying for idle capacity. Cloud Functions is for short event-driven tasks, not a full REST API. GKE Standard adds node management the company explicitly wants to avoid.
Exam objective: ACE exam guide 2.1: Planning and implementing compute resources — selecting appropriate compute choices for a given workload
Q2.A media company runs a nightly video-rendering batch job. The job is fault-tolerant: if a machine is interrupted, the job restarts from its last checkpoint. The company wants to minimize the cost of the compute. What should you recommend?
Explanation: Spot VMs sell spare capacity at a 60–91% discount and can be reclaimed with 30 seconds of warning — ideal for a fault-tolerant batch job that checkpoints its progress. Committed use discounts require a one- or three-year commitment and save less than Spot pricing. Cloud Run is for request-driven services, not long batch jobs, and a minimum instance count would waste money overnight. GKE Autopilot is a container platform, not the cheapest way to run interruptible batch compute.
Exam objective: ACE exam guide 2.1: Planning and implementing compute resources — using Spot VM instances as appropriate
Q3.A developer needs a VM with 6 vCPUs and 48 GB of memory — a ratio that does not match any predefined machine type. What should they use?
Explanation: Custom machine types let you specify an exact vCPU and memory combination, so you pay only for the resources you need instead of over-provisioning to the nearest predefined size. Accepting a larger predefined type wastes money. A Spot VM changes the pricing model, not the machine shape. Two smaller VMs change the application architecture and do not give one machine with the required resources.
Exam objective: ACE exam guide 2.1: Planning and implementing compute resources — using custom machine types as appropriate
Q4.A team wants to run a multi-service containerized application with service discovery, rolling updates, and horizontal pod autoscaling, and they want Google to manage the cluster nodes. Which option fits best?
Explanation: GKE Autopilot delivers Kubernetes features — service discovery, rolling updates, pod autoscaling — with Google managing the nodes, which matches both requirements. Cloud Run does not provide Kubernetes-native orchestration features such as in-cluster service discovery. Running Docker manually on Compute Engine means managing everything yourself. Cloud Functions is for event-driven code, not a multi-service containerized application.
Exam objective: ACE exam guide 2.1: Planning and implementing compute resources — selecting appropriate compute choices for a given workload
Q5.A company needs to process images uploaded to a Cloud Storage bucket: each upload should trigger a short task that creates a thumbnail and writes metadata to Firestore. Which service is the simplest fit?
Explanation: This is the textbook Cloud Functions use case: a short, stateless task triggered by an event (a Storage object creation). A polling VM wastes money running continuously and must be managed. A GKE CronJob is heavy infrastructure for a simple event reaction. A Cloud Run service with a minimum instance count would work but is more complex than a function and pays for idle instances.
Exam objective: ACE exam guide 2.1: Planning and implementing compute resources — selecting appropriate compute choices for a given workload
Q6.A legacy application requires a specific Linux kernel version and a licensed third-party agent that must be installed on the host operating system. Which compute option should you choose?
Explanation: Only Compute Engine gives you control of the host OS — the kernel version and host-installed agents cannot be specified on serverless or managed-node platforms. Cloud Functions runs code on Google-managed runtimes with no OS access. Cloud Run containers share Google's host kernel and cannot install host agents. GKE Autopilot manages the nodes, so you cannot choose the kernel or install host software.
Exam objective: ACE exam guide 2.1: Planning and implementing compute resources — selecting appropriate compute choices for a given workload
Q7.Which statement about Spot VMs is correct?
Explanation: The defining trade-off of Spot VMs is a 60–91% discount in exchange for preemptibility: Google can reclaim the capacity at any time with a 30-second warning. There is no minimum run guarantee. Spot VMs work fine in managed instance groups — in fact, mixing Spot and regular VMs in a group is a common cost pattern. They are available for most machine types, not only GPU types.
Exam objective: ACE exam guide 2.1: Planning and implementing compute resources — using Spot VM instances as appropriate
Q8.A startup is building a web application and expects traffic to grow from a few users to thousands over the first year. They have no operations staff and want the platform to handle scaling automatically. They have already containerized the application. Which service should they choose?
Explanation: Cloud Run matches every requirement: it runs their existing container, scales automatically from zero to thousands of instances, and needs no operations staff. A single large VM does not scale automatically and wastes money when idle. A fixed GKE Standard cluster requires node management and does not scale to zero. Cloud Functions is for event-driven tasks, not a containerized web application.
Exam objective: ACE exam guide 2.1: Planning and implementing compute resources — selecting appropriate compute choices for a given workload