0
0
GCPcloud~30 mins

Billing accounts and budgets in GCP - Mini Project: Build & Apply

Choose your learning style9 modes available
Billing Accounts and Budgets Setup in GCP
📖 Scenario: You are managing cloud costs for a small company using Google Cloud Platform (GCP). To keep track of spending and avoid surprises, you need to set up a billing account and create a budget with alerts.
🎯 Goal: Build a simple billing account configuration and a budget alert in GCP using Infrastructure as Code style. This will help monitor and control cloud expenses effectively.
📋 What You'll Learn
Create a billing account dictionary with exact fields
Add a budget threshold percentage variable
Create a budget configuration using the billing account and threshold
Complete the budget alert configuration with notification channels
💡 Why This Matters
🌍 Real World
Companies use billing accounts and budgets in GCP to monitor cloud spending and avoid unexpected charges.
💼 Career
Cloud engineers and financial operations teams set up budgets and alerts to manage costs and optimize cloud resource usage.
Progress0 / 4 steps
1
Create the billing account data structure
Create a dictionary called billing_account with these exact entries: 'account_id': '1234-5678-9012', 'display_name': 'Company Billing Account', and 'open': true.
GCP
Need a hint?

Use curly braces to create a dictionary and include the keys and values exactly as shown.

2
Add a budget threshold percentage variable
Create a variable called budget_threshold_percent and set it to 0.8 to represent 80% of the budget.
GCP
Need a hint?

Use a simple assignment to create the variable with the exact name and value.

3
Create the budget configuration dictionary
Create a dictionary called budget with these exact entries: 'billing_account_id' set to billing_account['account_id'], 'amount' set to 1000, and 'threshold_rules' as a list containing a dictionary with 'threshold_percent' set to budget_threshold_percent.
GCP
Need a hint?

Use the billing_account dictionary to get the account_id and create a list with one dictionary for threshold_rules.

4
Complete the budget alert configuration
Add a key 'notifications' to the budget dictionary. Set it to a list containing a dictionary with 'pubsub_topic' set to 'projects/my-project/topics/budget-alerts' and 'schema_version' set to '1.0'.
GCP
Need a hint?

Add the notifications key with a list containing a dictionary for the alert settings.