Prepare and test your skills
Prepare and test your skills
Compute right-sizing and cost-saving purchase models work together to lower baseline infrastructure cost without harming reliability. Right-sizing matches Compute Engine (opens in a new tab) instance shape to actual demand seen in utilization metrics, while purchase models lower the billing rate for that right-sized capacity through commitments, steady use, or use of spare capacity.
Right-sizing Compute Engine instances is the continuous practice of monitoring actual demand and adjusting allocation to avoid over-provisioning, which wastes money, and under-provisioning, which causes slowdowns. Utilization data flows from workloads to Cloud Monitoring (opens in a new tab) for real-time visibility, then from Cloud Monitoring to Recommender (opens in a new tab) for analysis, and Recommender returns machine type recommendations that identify underused resources or cheaper instance types. This loop lets teams base decisions on observed patterns rather than initial guesses, and idle VM recommendations identify unused instances and unattached resources for decommissioning.
Effective analysis tracks several dimensions of demand, not CPU alone:
Teams can configure alerts that notify administrators when thresholds are met so allocation can be adjusted in time. Regular review matters because pricing models and instance features change over time, so a size that was optimal can become expensive relative to newer options.
Compute Engine custom machine types are instance shapes where CPU and memory are selected independently to fit workloads with predictable, uneven resource needs. A workload that needs high memory but modest CPU no longer has to pay for unneeded cores in a predefined machine type, because the custom type provisions only the ratio the workload actually uses. Machine type recommendations from Recommender guide the starting choice, and the custom type refines that choice when the workload falls between standard sizes. Choose custom machine types when demand is stable and well understood but does not align with a standard machine family ratio.
Cost-saving purchase models reduce the rate paid for Compute Engine capacity after resources are right-sized. Committed use discounts (CUDs) (opens in a new tab) provide discounted prices for a one-year or three-year commitment, sustained use discounts reward consistent use within a billing cycle with no prior commitment, and Spot VMs provide unused capacity at a steep discount with preemption risk. CUDs can be applied on top of enterprise discounts, which are negotiated discounts for minimum total Google Cloud spend, for additional savings. Cost Management (opens in a new tab) budgets and alerts track spending against these choices by notifying owners when budgets are exceeded.
Google Cloud supports three commitment-related discount scopes:
The models differ in commitment, guarantee, and suitable workloads:
| Model | Commitment and scope | How cost is reduced |
|---|---|---|
| Resource-based CUDs | 1-year or 3-year quantity commitment in a specific region, shared across projects | Lowest stable rate for predictable regional baseline |
| Spend-based CUDs | 1-year or 3-year spend commitment on a product at billing account level | Flexible discount when usage spans regions or shapes |
| Sustained use discounts | No prior commitment; applies to resources used for more than a portion of the billing cycle | Automatic savings for steady-state VMs not covered by commitment |
| Spot VMs | No commitment; uses spare capacity that Compute Engine can preempt | More than 80% cheaper than regular VMs for fault-tolerant batch jobs |
Choose resource-based CUDs when the baseline is stable and pinned to a region, choose spend-based CUDs when spend is predictable but distributed, and choose Spot VMs only when the application tolerates interruption and can be shut down or rescheduled.
Exam tip: Resource-based CUDs lock a quantity in a specific region for 1 or 3 years, while Spot VMs require no commitment but can be preempted; use CUDs for stable baseline capacity and Spot VMs for fault-tolerant work that can be interrupted.
Storage lifecycle policies and data query cost management lower cost by moving data to cheaper storage as it cools and by limiting how much data is scanned. Cloud Storage (opens in a new tab) provides storage classes with Object Lifecycle Management and Autoclass for transitions and deletion, while BigQuery (opens in a new tab) provides on-demand and edition-based slot pricing with regional co-location to control analytical processing expense.
Cloud Storage classes separate actively used data from cold data by access frequency and retention need. Actively used datasets stay in Standard for low-latency access, while colder data moves to cheaper classes that trade retrieval cost for lower at-rest cost. Choosing Standard and then automatically downgrading objects avoids paying Standard rates for data that cools, while placing stable long-term retention directly in Archive avoids repeated transition churn.
| Storage class | Keep data when | Example workload |
|---|---|---|
| Standard | Data is actively used and frequently accessed | Current production models |
| Nearline or Coldline | Data is older or infrequently accessed but must remain readable | Older AI training datasets or less-frequently accessed backups |
| Archive | Data is kept for long-term retention with rare access | Compliance archives, optimized for energy efficiency at scale |
Cloud Storage Object Lifecycle Management (OLM) is the rule engine that automatically downgrades objects to a lower-cost class or deletes objects when conditions you set are met. A lifecycle configuration on the bucket evaluates object age and other conditions, then the service transitions cold objects from Standard to Nearline, Coldline, or Archive, or deletes expired objects without manual intervention. Cloud Storage Autoclass (opens in a new tab) is the automatic per-object alternative that transitions each object based on its observed access pattern.
Use OLM when retention rules are known in advance, such as downgrade after 30 or 90 days, and use Autoclass when objects in the same bucket cool at unpredictable rates. Define aggressive time to live (TTL) policies for non-essential data so rules delete it after a defined period:
Exam tip: Use Object Lifecycle Management to enforce a known downgrade or delete schedule, while Autoclass follows each object's actual access pattern when cooling rates vary.
Lifecycle governance in Cloud Storage and BigQuery depends on consistent tags and labels that carry ownership and retention metadata. Organization Policy Service (opens in a new tab) constraints require those tags at creation time, so automation and FinOps reporting can trust them downstream. Tags then flow from policy to action: lifecycle automation reads the retention period to select transitions or deletion, and billing export groups cost by owner and purpose for granular reports.
Apply tags that indicate at least three dimensions on every Cloud Storage bucket, BigQuery dataset, and persistent disk:
The same grouping supports carbon emissions reporting. Organization Policy Service resource-locations constraints extend governance to placement by restricting bucket creation in high-carbon or non-compliant regions.
Stored bytes determine both storage cost and the compute and I/O needed to read data, so format choice and right-sizing directly lower query expense. For analytics storage, compressed columnar formats are preferred over row-based formats because columnar layout reads only needed columns and occupies far less space. Prefer Parquet or optimized Avro over JSON or CSV for data that serves analytics workloads. The smaller footprint reduces disk-space needs, improves read efficiency, and lowers energy use for compute and I/O, which also reduces the bytes BigQuery must scan.
Right-size compute-attached storage in parallel with object data. Regularly audit persistent disks attached to Compute Engine instances for over-provisioning, use snapshots only when necessary for backup, delete old unused snapshots, and apply database retention policies to shrink underlying persistent disks.
Data regionality controls network transfer cost because moving bytes between regions consumes network resources and energy. The efficient topology keeps data and heavy processing in the same Google Cloud region, replicates across regions only for a stated requirement, and uses managed transfer paths for sharing. Deploy compute-intensive workloads such as AI training and BigQuery processing in the same region as the data source. Traffic then stays within the regional boundary instead of crossing to a distant processing region, which reduces egress charges and transfer energy.
Replicate across regions only to meet mandatory disaster recovery (DR) or high-availability (HA) requirements. Cross-region and multi-region replication increases energy cost and carbon footprint, so single-region with zonal redundancy is cheaper when DR or HA does not require it. When data must move across services, locations, or providers, use Storage Transfer Service (opens in a new tab) or data-sharing APIs instead of mass dumps, and for public datasets use Requester Pays buckets so the requester bears transfer and processing cost.
BigQuery analysis cost is driven by how much data is processed and which slot pricing model backs the queries. BigQuery on-demand pricing charges per bytes scanned, while BigQuery editions provide capacity-based pricing based on commitments and autoscaling that lowers cost per slot for sustained volume. On-demand fits sporadic or exploratory queries where committed slots would sit idle, while an edition with committed slots fits steady analytics volume where the discounted rate offsets the commitment.
Because editions support autoscaling of slots, baseline commitments can cover steady load while autoscaled slots absorb peaks without permanent over-provisioning. Reduce the processing itself by shrinking scanned bytes and avoiding cross-region reads. Store inputs in Parquet or Avro to lower scan volume, aggregate detailed data and retain only aggregates long term when detail is no longer needed, and run BigQuery jobs in the same region as source buckets and datasets.
Container resource allocation and Google Kubernetes Engine (GKE) autoscaling align Pod resource supply with real-time demand to maximize packing density while maintaining reliability. Precise resource requests determine where Pods can be scheduled, while limits cap peak usage, and four GKE autoscaling tools adjust different layers in response to demand. Together they prevent over-provisioning and idle capacity without causing bottlenecks.
Container resource requests and limits control how efficiently Pods pack onto nodes in Google Kubernetes Engine (GKE) (opens in a new tab). A request is the guaranteed CPU and memory that the scheduler uses to place a Pod on a node with enough free capacity, so accurate requests let the scheduler pack more Pods per node. A limit is the maximum CPU and memory a container can consume, which prevents one container from starving others on the same node. When requests are set far above actual use, nodes appear full while CPUs sit idle, which drives over-provisioning and higher cost.
Cloud Monitoring (opens in a new tab) provides real-time visibility into utilization to expose the gap between allocation and actual use, while Recommender analyzes historical utilization to recommend right-sized requests and limits. Custom metrics and alerts can trigger automated right-sizing when thresholds are met, so administrators adjust allocation before performance degrades. This continuous monitor, recommend, and adjust loop makes autoscaling effective, because autoscalers depend on accurate requests to make correct decisions.
The Horizontal Pod Autoscaler (HPA) (opens in a new tab) adjusts workload capacity by changing the number of Pod replicas in a workload. When traffic spikes, HPA adds Pods to distribute load, and when traffic subsides, HPA reduces Pods to avoid paying for unnecessary compute. HPA scales on CPU, memory, or custom metrics, and for cloud-first applications horizontal scaling is preferred over simply enlarging each instance. Because load spreads across many replicas, the failure of one instance does not affect availability.
HPA depends on workloads that can scale horizontally, which requires stateless design where session state lives outside the compute instance. When session state is stored externally, such as in Memorystore for Redis, any Pod can handle any request and new replicas become useful immediately. For asynchronous work, HPA should scale on behavior-specific signals such as queue depth, request latency, or custom application metrics rather than CPU alone. Clear scaling policies with defined thresholds prevent flapping, where replica count oscillates rapidly from frequent unnecessary scaling.
The Vertical Pod Autoscaler (VPA) adjusts workload size by fine-tuning CPU and memory requests and limits for individual containers based on usage patterns. VPA observes actual container consumption over time and then raises or lowers the request and limit so a container is not allocated more than it needs. This correction prevents over-provisioning at the container level and improves packing density, because right-sized requests let the scheduler fit more Pods onto each node. Unlike HPA, VPA does not change replica count; it changes the shape of each Pod.
For complex workloads, multidimensional Pod autoscaling configures HPA and VPA simultaneously to optimize both Pod count and Pod size. In this combination, VPA rightsizes per-Pod requests and limits while HPA adds or removes replicas to meet throughput demand, which produces the smallest footprint for the required performance. This pairing is most valuable when demand varies in both intensity per request and total volume. Accurate VPA recommendations depend on stable observation, so frequent redeploys or highly spiky short-lived Pods reduce its effectiveness.
The Cluster Autoscaler adjusts infrastructure capacity by adding or removing nodes based on Pod resource demands. When pending Pods cannot be scheduled because existing nodes lack sufficient requested CPU or memory, the Cluster Autoscaler adds nodes to accommodate them. When nodes become underutilized after HPA scales Pods down, the Cluster Autoscaler removes nodes to eliminate idle capacity. In this way Pod-level demand flows from HPA and scheduling to node-level supply, and node supply contracts only after Pod demand falls.
Node Auto-Provisioning extends cluster scaling by automatically creating optimized node pools for workloads that do not fit existing pools. Instead of requiring an administrator to predefine every machine type, Node Auto-Provisioning selects and provisions a pool whose CPU, memory, and hardware profile matches unscheduled Pod requirements. The new nodes then accept the pending Pods, while the Cluster Autoscaler continues to manage scale-in when demand drops. Together the two controls let the cluster resize and reshape automatically as workload mix changes.
Combining autoscalers means assigning each GKE tool to its own layer so container size, replica count, and node capacity scale as a chain. The chain runs in order: VPA rightsizes container requests, HPA changes replicas based on those rightsized Pods, Cluster Autoscaler adds or removes nodes for schedulable Pods, and Node Auto-Provisioning creates new pool shapes when Pods fit no existing pool.
| Tool | What it scales | Scaling signal |
|---|---|---|
| Horizontal Pod Autoscaler | Number of Pod replicas | CPU, memory, or custom metrics such as queue depth and latency |
| Vertical Pod Autoscaler | CPU and memory requests and limits per container | Historical usage patterns per container |
| Cluster Autoscaler | Number of nodes in existing pools | Unschedulable Pod demands and node underutilization |
| Node Auto-Provisioning | Creation of optimized node pools | Pod demands that do not fit current pools |
Effective policies combine reactive scaling and proactive scaling across these tools. Reactive scaling responds to real-time load and suits unpredictable spikes, while proactive scaling pre-provisions for predictable patterns such as daily business hours, weekly reports, or major sales events. Managed capabilities such as GKE Autopilot learn from workload patterns to handle part of that preparation automatically. Choosing custom thresholds tied to application behavior, rather than CPU alone, ensures each layer scales for the right reason.
Exam tip: HPA changes how many Pods run, VPA changes how large each Pod's requests and limits are, and Cluster Autoscaler changes how many nodes are available to host those Pods.
Resource-based Committed Use Discounts (CUDs) lock a minimum quantity of Compute Engine resources in a specific region for one year or three years to provide the lowest stable rate for predictable regional baseline. Spot VMs use spare capacity with no commitment at more than 80 percent cheaper than regular VMs but Compute Engine can preempt them. Choose resource-based CUDs for stable baseline capacity and Spot VMs only for fault-tolerant batch jobs that tolerate interruption and can be shut down or rescheduled.
Use Cloud Storage Object Lifecycle Management (OLM) when retention rules are known in advance, such as downgrading objects from Standard to Nearline, Coldline, or Archive after 30 or 90 days or deleting expired objects. Use Cloud Storage Autoclass when objects in the same bucket cool at unpredictable rates because it transitions each object based on its observed access pattern rather than a preset schedule.
Horizontal Pod Autoscaler (HPA) changes the number of Pod replicas in a workload based on CPU, memory, or custom metrics such as queue depth and latency. Vertical Pod Autoscaler (VPA) changes CPU and memory requests and limits for individual containers based on historical usage patterns without changing replica count. Cluster Autoscaler changes the number of nodes in existing pools by adding nodes for unschedulable Pods and removing nodes when they become underutilized.
Your organization runs dynamically scaled container workloads on Google Kubernetes Engine (GKE) and is implementing FinOps practices to eliminate waste and optimize resource packing density. You deploy custom ComputeClass resources to manage auto-created node pools for variable workloads.
During off-peak periods, you observe that several nodes with low CPU and memory utilization remain running for prolonged periods before being reclaimed, resulting in unnecessary infrastructure compute spend. You need to fine-tune the node consolidation behavior to more aggressively consolidate workloads onto fewer nodes and reduce the duration underutilized nodes persist before removal.
Which configuration in the ComputeClass definition should you implement?
Last updated