This chapter covers GCP cost management, a critical topic for the ACE exam as it appears in roughly 10-15% of questions under Domain 4 (Ensuring Success). You will learn the core cost management tools, how to set budgets and alerts, how committed use and sustained use discounts work, and how to use the Recommender to optimize spending. Mastering these concepts ensures you can control cloud costs effectively, a key responsibility for any cloud engineer. Expect exam questions that test your ability to select the right tool for a given scenario and understand the pricing mechanics of Compute Engine and BigQuery.
Jump to a section
Managing GCP costs is like managing a household budget. Your monthly income is your budget, and each cloud service (Compute Engine, Cloud Storage, BigQuery) is a category like rent, groceries, or utilities. Just as you track spending with a spreadsheet or app, GCP provides tools like the Cost Table, Budgets & Alerts, and Reports. A budget alert is like setting a notification when you've spent 50% of your grocery budget — it warns you before you overspend. Committed use discounts are like signing a lease for a year to get a lower rent; you commit to paying a fixed amount monthly, and in return, you get a discount. Sustained use discounts are like a loyalty reward for consistently buying from the same store — the more you use a service, the lower the unit price. Quotas are like a spending limit on your credit card; they prevent you from accidentally spending more than intended. Just as you review your bank statements monthly, GCP's Recommender analyzes your usage and suggests optimizations, like downgrading an unused VM or deleting stale snapshots. Without proper budgeting, you might get a surprise bill, just like an unexpected credit card charge.
What is GCP Cost Management?
GCP cost management encompasses a set of tools and practices to monitor, control, and optimize cloud spending. The primary tools are the Google Cloud Console's Billing section, the Cloud Billing API, Budgets & Alerts, and the Recommender. The goal is to prevent cost overruns, identify waste, and take advantage of pricing discounts. GCP offers two main types of discounts: committed use discounts (CUDs) and sustained use discounts (SUDs). CUDs require a 1- or 3-year commitment for a specific resource (e.g., vCPUs, memory) in a region, providing up to 70% discount. SUDs are automatic and apply per project per region for resources running more than 25% of a month, offering up to 30% discount. Both discounts apply to Compute Engine, Cloud SQL, and other services. Understanding these discounts is essential for the exam; you must know the minimum commitment (1 year), the discount percentages, and that CUDs are purchased at the project level but can be shared across projects with a billing account.
How Cost Management Works Internally
GCP's billing system aggregates usage from all resources across projects under a billing account. Usage data is collected every hour and sent to the billing pipeline. The Cost Table in the console provides a near-real-time view of costs, with a latency of about 5-10 minutes. Budgets are created at the billing account or project level. When a budget threshold is met (e.g., 50%, 90%, 100%), an alert is triggered via email or Pub/Sub. The budget amount can be a fixed amount or based on the previous month's spend. Alerts can also be sent to Cloud Monitoring for automated responses. The Recommender uses machine learning to analyze usage patterns and provides recommendations such as: deleting idle VMs, resizing over-provisioned VMs, changing machine types, and deleting unused snapshots or disks. Each recommendation includes potential monthly savings. The exam tests your ability to interpret these recommendations and implement them.
Key Components, Values, and Defaults
Committed Use Discounts (CUDs): Available for vCPUs, memory, GPUs, and local SSDs. Minimum commitment: 1 year. Discounts: 57% for 1-year, 70% for 3-year for most resources. CUDs are region-specific. You can purchase CUDs in the Billing section. They apply to all projects under the same billing account. The exam often asks: "Which discount requires a 1-year commitment?" Answer: CUDs.
Sustained Use Discounts (SUDs): Automatic for Compute Engine instances running more than 25% of a month. Discount is cumulative per resource type (e.g., all n1-standard-4 VMs in a region). The discount rate increases with usage: 0% for up to 25%, 20% for 25-50%, 30% for 50-100%. SUDs are applied at the project level. The exam may test: "What is the minimum usage to get a SUD?" Answer: 25% of a month.
Budgets & Alerts: Budgets can be set at the billing account or project level. Alert thresholds: 50%, 90%, 100% (customizable). Alerts can be sent to email addresses or Cloud Pub/Sub topics. The default budget amount is the previous month's spend. The exam expects you to know that budgets do not stop spending; they only alert.
Quotas: Quotas are not cost management tools but prevent resource overuse. There are rate quotas (e.g., API requests per second) and allocation quotas (e.g., number of VMs per region). Quotas can be increased by requesting from Google Cloud Support.
Cost Table and Reports: The Cost Table shows costs by project, service, SKU, or label. Reports provide historical trends. You can group costs by labels, which are key-value pairs attached to resources. The exam tests that labels are used for cost allocation.
Configuration and Verification Commands
Creating a budget: In the console, go to Billing > Budgets & Alerts > Create Budget. Specify name, amount, and threshold rules. Alternatively, use the Cloud Billing API:
POST https://cloudbilling.googleapis.com/v1/billingAccounts/{billing_account_id}/budgets
{
"displayName": "Monthly Budget",
"budgetFilter": {
"projects": ["projects/my-project-id"]
},
"amount": {
"specifiedAmount": {
"currencyCode": "USD",
"units": 1000
}
},
"thresholdRules": [
{"thresholdPercent": 0.5},
{"thresholdPercent": 0.9},
{"thresholdPercent": 1.0}
]
}Viewing discounts: Use gcloud compute commitments list to view CUDs. For SUDs, there is no direct command; they appear in billing reports. The exam does not require extensive gcloud commands for cost management but may ask about gcloud beta billing budgets.
Using Recommender: In the console, go to Recommender > Cost Optimization. Recommendations include:
- Delete idle VM instances (idle for > 7 days)
- Resize VM: n1-standard-4 to n1-standard-2 (saving $X/month)
- Delete unused disks (not attached to any VM)The exam may ask: "Which tool provides cost optimization recommendations?" Answer: Recommender.
Interaction with Related Technologies
Cloud Monitoring: Budget alerts can be sent to Cloud Monitoring via Pub/Sub, enabling automated workflows like shutting down non-production environments when costs exceed a threshold.
Cloud Functions: You can trigger a Cloud Function from a budget alert to automatically stop or delete resources.
BigQuery: BigQuery costs are based on the amount of data processed (analysis pricing) and storage. The exam tests pricing models: on-demand (per TB processed) vs. flat-rate (slots). Committed use discounts apply to BigQuery slots. Sustained use discounts do not apply to BigQuery.
Cloud Storage: Costs are based on storage class (Standard, Nearline, Coldline, Archive) and retrieval fees. The exam tests that you can reduce costs by moving data to colder storage classes using lifecycle policies.
Network Egress: Data transfer out of GCP to the internet or other regions incurs costs. The exam may ask about free tiers (e.g., 1 GB egress per month to internet for all services combined).
Exam-Specific Details
The ACE exam expects you to know that CUDs are purchased, SUDs are automatic, and both are applied at the billing account level (CUDs can be shared).
Budgets do not stop costs; they only alert. To stop spending, you must take action manually or via automation.
Labels are used for cost allocation and can be applied to most resources. The exam tests that labels are not inherited; you must apply them to each resource.
The Recommender provides cost optimization recommendations for Compute Engine, Cloud SQL, and BigQuery. It does not cover networking or storage directly.
The exam may present a scenario where you need to reduce costs for a batch job that runs for 2 hours daily. The correct answer is to use preemptible VMs (up to 80% discount) instead of CUDs or SUDs.
Common wrong answer: Choosing CUDs for short-lived workloads (CUDs require 1-year commitment).
Another trap: Selecting a budget to stop spending; budgets only alert.
Summary of Best Practices
Use labels to track costs by department or environment.
Set budget alerts at 50%, 90%, and 100%.
Purchase CUDs for steady-state workloads.
Use preemptible VMs for fault-tolerant batch jobs.
Use the Recommender to identify idle resources.
Move infrequently accessed data to Nearline or Coldline storage.
Monitor egress costs and use Cloud CDN or VPC peering to reduce them.
Review billing reports monthly to identify anomalies.
Set up a billing account
A billing account is required to use GCP services. It is linked to a payment profile (credit card or invoice). You can have multiple billing accounts for different departments or projects. The billing account is created in the Cloud Console under Billing. You can assign projects to a billing account. The exam may test that you must have a billing account to use services beyond the free tier. Without a billing account, resources cannot be created (except for some free tier resources).
Create budgets and alerts
In the Billing section, create a budget for a project or billing account. Set the budget amount (e.g., $1000). Define alert thresholds: typically 50%, 90%, and 100% of the budget. Alerts can be sent to email addresses or Pub/Sub topics. For email, you add recipients. For Pub/Sub, you create a topic and attach a Cloud Function to automate responses. The alert is triggered when the actual cost exceeds the threshold. Note: there is a delay of up to 5-10 minutes in cost data, so alerts are near-real-time but not instantaneous.
Purchase committed use discounts
For predictable workloads, purchase CUDs. In the console, go to Billing > Committed Use Discounts > Purchase. Select region, resource type (vCPUs, memory, GPUs), commitment length (1 or 3 years), and amount. The discount applies immediately to eligible usage across all projects under the billing account. For example, if you commit to 10 vCPUs in us-central1, any project in that billing account using n1-standard VMs in us-central1 will get the discount. Unused commitment is billed at the committed price. The exam tests that CUDs are region-specific and that you cannot cancel a commitment.
Use sustained use discounts automatically
SUDs are applied automatically at the end of each month. There is no action required. The discount is calculated per project per region per resource type. For example, if you run an n1-standard-4 VM for 30 days (100% usage), you get a 30% discount on that VM's compute cost. If you run it for 10 days (33% usage), you get a 20% discount on those 10 days. The discount is applied as a line item in the billing report. Note: SUDs do not apply to GPUs or local SSDs. The exam may ask: "What discount applies automatically?" Answer: SUDs.
Analyze costs with Reports and Cost Table
Use the Cost Table to view current costs by project, service, or SKU. Use Reports for historical trends. You can filter by date range, project, or labels. For example, to see costs for the 'production' environment, apply a label filter. Export billing data to BigQuery for custom analysis. The exam tests that you can use labels to group costs and that Reports can be exported to CSV. The Cost Table is near-real-time; Reports are updated daily.
Optimize with Recommender
The Recommender analyzes usage and suggests cost-saving actions. For Compute Engine, it recommends deleting idle VMs (idle for 7+ days), resizing over-provisioned VMs, and removing unused disks. For BigQuery, it suggests slot commitments. For Cloud SQL, it suggests reducing tier sizes. Each recommendation includes estimated savings. You can apply recommendations directly from the console. The exam tests that the Recommender is the tool for cost optimization suggestions.
Scenario 1: A startup runs a web application on Compute Engine with 10 n1-standard-4 VMs (4 vCPUs, 15 GB each) in us-central1. The workload is steady 24/7. The CTO wants to reduce costs. The engineer purchases a 1-year CUD for 40 vCPUs and 150 GB of memory in us-central1, achieving a 57% discount on the compute costs. Additionally, the engineer sets budget alerts at 90% of the monthly budget to avoid surprises. They also enable the Recommender, which suggests that one VM is idle (no network activity for 7 days) and can be deleted. After deletion, the engineer adjusts the CUD commitment to 36 vCPUs to avoid paying for unused commitment. The result: 30% overall cost reduction. The common pitfall is forgetting to adjust CUDs after scaling down, leading to paying for unused capacity.
Scenario 2: An enterprise uses BigQuery for analytics, processing 50 TB per month. The on-demand cost is $5 per TB, totaling $250 per month. To reduce costs, the engineer purchases a flat-rate slot commitment of 500 slots for 3 years, which costs $2,000 per month but includes unlimited querying. For this workload, the flat-rate is more expensive, so the engineer instead uses a 1-year CUD for BigQuery slots (500 slots at 57% discount), bringing the cost to $860 per month. The engineer also sets up a budget alert at $1,000 to monitor spending. The exam-relevant lesson: always compare on-demand vs. flat-rate pricing based on usage. A common mistake is assuming flat-rate is always cheaper.
Scenario 3: A media company stores 100 TB of video files in Cloud Storage Standard class. Access frequency is once a month. The engineer implements a lifecycle policy to move objects older than 30 days to Nearline (lower cost) and after 90 days to Coldline. This reduces storage costs by 70%. The engineer also uses labels to track costs by department (e.g., label: department=marketing). The exam tests that lifecycle policies are configured in the bucket settings and that labels are applied at the object or bucket level.
The ACE exam tests cost management under Objective 4.2: "Manage costs for a GCP implementation." Expect 3-5 questions on this topic. The most common wrong answers stem from confusing CUDs and SUDs. Candidates often choose CUDs for short-lived workloads (e.g., a batch job that runs for 2 hours daily) because they think any discount is good. The correct answer is preemptible VMs, which can be up to 80% cheaper and have no commitment. Another trap: selecting a budget to stop spending. Budgets only alert; they do not terminate resources. To stop spending, you must use automation (e.g., Cloud Functions triggered by budget alerts). The exam also tests that SUDs are automatic and apply per project per region, not per billing account. A common question: "Which discount requires a 1-year commitment?" Answer: Committed use discounts. Another: "What is the maximum sustained use discount?" Answer: 30%. The specific numbers you must memorize: CUD discount percentages (57% for 1-year, 70% for 3-year for most resources; 70% for 1-year for GPUs? Actually GPUs are 57% for 1-year, 70% for 3-year). SUD minimum usage: 25% of month. The exam loves edge cases: e.g., what happens if you run a VM for 25% of the month? You get 20% discount (since 25% is the threshold, the discount applies to the entire usage? Actually, the discount is applied to the portion above 25%. The exam may not test this nuance deeply). Another edge: CUDs are region-specific; if you buy a CUD in us-central1, it does not apply to resources in us-east1. The exam may present a scenario where an engineer buys a CUD for the wrong region. Also, budgets can be set at the billing account or project level; alerts can be sent to Pub/Sub. The exam may ask: "Which service can receive budget alerts to trigger automated actions?" Answer: Cloud Pub/Sub. Finally, the Recommender provides cost recommendations for Compute Engine, Cloud SQL, and BigQuery. A question might ask: "Which tool suggests deleting idle VMs?" Answer: Recommender. To eliminate wrong answers, focus on the mechanism: CUDs are purchased, SUDs are automatic, budgets are alerts only, and the Recommender is advisory.
Budgets only alert; they do not stop spending.
CUDs require a 1- or 3-year commitment and are region-specific.
SUDs are automatic and provide up to 30% discount for usage over 25% of a month.
Preemptible VMs offer up to 80% discount but can be terminated at any time.
Labels are used for cost allocation and must be applied per resource.
The Recommender provides cost optimization suggestions for Compute Engine, Cloud SQL, and BigQuery.
CUD discount percentages: 57% for 1-year, 70% for 3-year (most resources).
SUD minimum usage threshold: 25% of a month.
Budget alerts can be sent via email or Pub/Sub.
Data transfer out of GCP to internet incurs costs; use Cloud CDN to reduce egress.
BigQuery pricing: on-demand ($5 per TB processed) or flat-rate (slots).
Lifecycle policies can move objects to colder storage classes to reduce costs.
These come up on the exam all the time. Here's how to tell them apart.
Committed Use Discounts (CUDs)
Requires 1- or 3-year commitment
Up to 70% discount (57% for 1-year, 70% for 3-year)
Purchased manually per region and resource type
Applies to billing account level (shared across projects)
Best for steady-state, predictable workloads
Sustained Use Discounts (SUDs)
No commitment required
Up to 30% discount (automatic)
Applied automatically per project per region
Applies at the project level
Best for variable or moderate usage workloads
Preemptible VMs
Up to 80% discount
No commitment, but can be terminated at any time
No SLA
Best for batch jobs, fault-tolerant workloads
Cannot be migrated or live migrated
Regular VMs with CUDs
Up to 70% discount with commitment
Requires 1- or 3-year commitment
Full SLA and reliability
Best for production, long-running workloads
Supports live migration and automatic restart
Mistake
Budgets automatically stop resource usage when exceeded.
Correct
Budgets only send alerts; they do not stop spending. To stop resources, you must configure automation using Cloud Functions or other tools triggered by the budget alert via Pub/Sub.
Mistake
Sustained use discounts require a 1-year commitment.
Correct
SUDs are automatic and require no commitment. They apply when a resource runs more than 25% of a month. Committed use discounts require a 1- or 3-year commitment.
Mistake
Committed use discounts apply to all resources in a project regardless of region.
Correct
CUDs are region-specific. If you purchase a CUD in us-central1, it only applies to resources in us-central1 under the same billing account.
Mistake
Labels are inherited from the project to resources.
Correct
Labels are not inherited. You must apply labels directly to each resource (e.g., VM, disk, bucket). Project-level labels do not propagate to resources.
Mistake
The Recommender can automatically apply cost-saving recommendations.
Correct
The Recommender provides recommendations, but you must manually apply them (e.g., delete a VM, resize a machine type). It does not auto-apply changes unless you configure automation separately.
Reveal each answer, then mark whether you got it right. Score 60%+ to unlock the next chapter.
Committed use discounts (CUDs) require a 1- or 3-year commitment for a specific resource (e.g., vCPUs, memory) in a region, offering up to 70% discount. Sustained use discounts (SUDs) are automatic and apply per project per region when a resource runs more than 25% of a month, offering up to 30% discount. CUDs are purchased; SUDs are applied automatically. For the exam, remember that CUDs are for steady workloads, SUDs are for moderate usage.
Budgets only send alerts; they do not stop resources. To stop resources automatically, create a budget alert that sends a notification to a Cloud Pub/Sub topic. Then, create a Cloud Function that is triggered by the Pub/Sub message and stops or deletes resources (e.g., using the Compute Engine API). The exam expects you to know that budgets are alerts only, and automation requires Cloud Functions or similar.
No, committed use discounts cannot be canceled. You are billed for the entire commitment period regardless of usage. If you don't use the committed resources, you still pay for them. The exam may test that you should only purchase CUDs for predictable workloads.
The maximum sustained use discount is 30%, achieved when a resource runs 100% of a month. The discount is applied to the compute cost (vCPUs and memory) but not to GPUs or local SSDs. The discount rate increases with usage: 0% for up to 25%, 20% for 25-50%, 30% for 50-100%.
Labels are key-value pairs you attach to resources. For example, you can add label 'environment=production' to VMs, disks, and buckets. In the Cost Table or Reports, you can filter or group by labels to see costs per environment. Labels must be applied per resource; they are not inherited from the project. The exam tests that labels are used for cost allocation and that they are not inherited.
The Recommender is a GCP tool that uses machine learning to provide cost optimization recommendations. For Compute Engine, it suggests deleting idle VMs (idle for 7+ days), resizing over-provisioned VMs, and removing unattached disks. For BigQuery, it recommends slot commitments. For Cloud SQL, it suggests reducing tier sizes. Each recommendation includes estimated monthly savings.
You can reduce BigQuery costs by using flat-rate pricing (purchasing slots) for predictable workloads, using clustered and partitioned tables to scan less data, and using materialized views. On-demand pricing charges $5 per TB processed. The exam tests that you should use flat-rate for high-usage scenarios and optimize queries to scan less data.
You've just covered GCP Cost Management — now see how well it sticks with free ACE practice questions. Full explanations included, no account needed.
Done with this chapter?