VOOZH about

URL: https://dev.to/kkuj/monitor-google-cloud-platform-costs-on-your-iphone-and-apple-watch-420f

⇱ Monitor Google Cloud Platform Costs on Your iPhone and Apple Watch - DEV Community


Keep an eye on your GCP costs right from your wrist. Don't let autoscaling silently run up your bill — stay informed with a quick glance at your iPhone or Apple Watch.

Here's the plan:

  1. Configure GCP billing export to a BigQuery table
  2. Create an n8n workflow that queries BigQuery for cost data
  3. Set up a widget in API Widgets to display the results

Configure GCP Billing Export to BigQuery

1. Enable the BigQuery API in GCP

👁 Enable BigQuery API in the GCP console

2. Enable billing export to BigQuery

👁 Enable billing export to BigQuery

3. Create a service account for BigQuery access

gcloud iam service-accounts create n8n-bigquery-reader \
 --display-name="n8n BigQuery Reader" \
 --project=YOUR_PROJECT_ID

4. Assign minimal permissions

The service account needs just two roles:

  • bigquery.jobUser — allows running queries
  • bigquery.dataViewer — allows reading tables and views (read-only)
# Allow running queries and reading results
gcloud projects add-iam-policy-binding YOUR_PROJECT_ID \
 --member="serviceAccount:n8n-bigquery-reader@YOUR_PROJECT_ID.iam.gserviceaccount.com" \
 --role="roles/bigquery.jobUser"

# Allow reading data from datasets and tables
gcloud projects add-iam-policy-binding YOUR_PROJECT_ID \
 --member="serviceAccount:n8n-bigquery-reader@YOUR_PROJECT_ID.iam.gserviceaccount.com" \
 --role="roles/bigquery.dataViewer"

5. Generate a service account key for n8n

gcloud iam service-accounts keys create n8n-bigquery-key.json \
 --iam-account=n8n-bigquery-reader@YOUR_PROJECT_ID.iam.gserviceaccount.com

This generates a n8n-bigquery-key.json file containing the service account credentials. You'll use this file to authenticate the BigQuery node in n8n.

Set Up the n8n Workflow

The workflow exposes a webhook endpoint that API Widgets can call. When triggered, it queries BigQuery for your billing data, groups costs by date and service, and returns the results as JSON.

👁 n8n workflow for querying GCP billing costs

The workflow consists of five nodes:

  1. Webhook — listens for incoming requests (accepts an optional days query parameter, defaults to 14)
  2. Configure variables — sets the BigQuery table name and the number of days to query
  3. Execute BigQuery — runs a SQL query that aggregates daily costs by service
  4. Format data — transforms the results into a structured JSON response with daily totals and per-service breakdowns
  5. Respond to Webhook — sends the formatted data back to the caller

You can import the workflow into your n8n instance using the JSON file: GCP Billing costs.json. Make sure to update the table_name variable in the "Configure variables" node to match your BigQuery billing export table.

Configure API Widgets

1. Download API Widgets from the App Store.

2. Create a new widget and configure the API endpoint in the Source tab, pointing it to your n8n webhook URL.

3. Set up the visualization in the Design tab.

👁 API Widgets design configuration on iPhone - screenshot

4. Add a home screen widget and link it to the one you just created.

👁 iPhone home screen with GCP cost widget - screenshot

👁 iPhone home screen with GCP cost widget bar details - screenshot

The widget also works on Apple Watch — view your costs at a glance from your wrist:

👁 Apple Watch home screen with GCP cost widget - screenshot

👁 Apple Watch widget showing GCP cost chart - screenshot

👁 Apple Watch widget showing cost breakdown details - screenshot