
Answer-first summary for fast verification
Answer: Assign all instances a label specific to the system they run. Configure BigQuery billing export and query costs per label.
The question requires tracking costs for distinct systems running on dedicated Compute Engine instances in the same GCP project. The optimal solution involves accurately associating costs with each system. Option B is correct because: 1. **Labeling instances**: Assigning labels (e.g., `system=prod-app`) to Compute Engine instances allows GCP to track resource usage metadata, including costs, based on these labels. Labels are designed for cost allocation and categorization. 2. **BigQuery billing export**: Exporting billing data to BigQuery captures detailed cost information, including labels. Querying BigQuery for costs grouped by the system-specific label provides precise, granular cost breakdowns per system. Option A is incorrect because the Cost Breakdown section in the GCP Console relies on pre-existing labels or other dimensions but does not inherently group costs by a custom "system" without labels being applied first. It is a visualization tool, not a setup step. Option C is incorrect because Stackdriver Logging (now Cloud Logging) exports logs, not billing data. Metadata on instances is not integrated with billing exports, making it ineffective for cost tracking. Option D is suboptimal because: - VM names are not designed for cost grouping; they lack the structured key-value format of labels. - Querying costs based on VM names in BigQuery would require complex string parsing and is error-prone (e.g., inconsistent naming). - Exporting to Cloud Storage first adds unnecessary complexity compared to direct BigQuery billing exports. Thus, labeling and BigQuery billing export (Option B) is the GCP best practice for cost allocation.
Author: LeetQuiz Editorial Team
Ultimate access to all questions.
You manage multiple production systems running on Compute Engine within the same Google Cloud Platform (GCP) project, each with its own dedicated instances. How can you determine the cost of running each individual system?
A
In the Google Cloud Platform Console, use the Cost Breakdown section to visualize the costs per system.
B
Assign all instances a label specific to the system they run. Configure BigQuery billing export and query costs per label.
C
Enrich all instances with metadata specific to the system they run. Configure Stackdriver Logging to export to BigQuery, and query costs based on the metadata.
D
Name each virtual machine (VM) after the system it runs. Set up a usage report export to a Cloud Storage bucket. Configure the bucket as a source in BigQuery to query costs based on VM name.
No comments yet.