DEV Community

Cover image for How Can We Build a Self-Refreshing Dashboard on Google Cloud for ~$1
Saketh Reddy
Saketh Reddy

Posted on

How Can We Build a Self-Refreshing Dashboard on Google Cloud for ~$1

A dashboard is really two things: a query/logic, and somewhere to put the result. The query is the interesting part. “The somewhere is what you pay for”.

This is how I built the second part for about a dollar a year – “no server, no BI licence, no build” step. One HTML file in a storage bucket, rebuilt on a schedule, by a Python job in Vertex AI.

See the live dashboard || Code on GitHub

What it costs

Most teams reach for a BI platform here, and per-seat licences at list price generally land somewhere between $15 and $75 per user per month. For a team of fifty, that is a five-figure($XX,XXX) annual bill before anyone has written a single query. Enterprise tiers are quoted rather than published, which tells you roughly where they sit.

Here is the whole bill for InsightPilot-AI approach:

Line What it actually comes to
BigQuery ~8 MB scanned a week — under 0.1% of the free monthly terabyte (Depends on size of data)
Scheduled compute a few minutes a week, under 2¢ a run
Storage one 200 KB file, $0.000005 a month
Total roughly $1 a year

Almost all of that dollar is the compute for the scheduled job. Every view ships the whole 200 KB file, but a hundred thousand views is 20 GB, still inside the free allowance.

The Architecture

 BigQuery                     Scheduled Python job              Cloud Storage
 your dataset     ──SQL──▶    1. run the query      ──HOST──▶  one .html file
                              2. inject the rows                served directly
                              3. upload the page
Enter fullscreen mode Exit fullscreen mode

Three moving parts, and only one of them is code we had to write.

Security protocols followed

"A static file in a bucket" sounds like it means "public," and that is the part people get wrong. Access here is controlled by IAM, exactly as it would be on any other Google Cloud resource. The demo above is public because the data is public; nothing about the pattern requires that.

Private by construction, not by remembering. The bucket is created with uniform bucket-level access on and public access prevention enforced. Until you deliberately grant something, nothing is reachable, and with prevention enforced, the server refuses a static public grant rather than quietly allowing it.

Then grant access to principals, not to the internet. Any of these work on the bucket, and they are what makes this viable for company data:

Principal Who that is
user:alex@company.com one named person
group:analytics-team@company.com a Google Group — membership managed in Workspace, not in GCP
domain:company.com every account in your Workspace / Cloud Identity domain, and nobody else
allUsers anyone on the internet — only for genuinely public data

Domain: is the one that makes this work internally: everyone with a company account can open the dashboard, and nobody outside it can. A group is better still, because access follows the group membership your identity team already maintains, and revoking someone is removing them from the group.

One trap worth naming. allAuthenticatedUsers sounds like “signed-in people at my company.” It isn't; it means anyone with any Google account, including personal Gmail. It is effectively public. Use domain or a group. Google now blocks allUsers and allAuthenticatedUsers grants by default in organizations created since May 2024, which tells you how often that one bites.

Least privilege for the job itself. The refresh runs as a service account with exactly two roles - BigQuery Job User on the project and Storage Object User on the bucket. It can run queries and write one object. It cannot change IAM, delete the bucket, or touch anything else in the project.

One real limitation. A public grant cannot be narrowed to a single object: IAM conditions are rejected on public resources, and per-object ACLs are disabled by the uniform bucket-level access you want switched on. So, if some objects must stay private while others are world-readable, use two buckets. For the internal case, this never comes up, because nothing is public to begin with.

Run it yourself

Everything is on GitHub, set up as a template. You can see the page with generated sample data before touching Google Cloud at all:

git clone https://github.com/Saketh-Labs/InsightPilot-AI.git
cd InsightPilot-AI
python refresh_dashboard.py --data dashboard/data.json --no-upload --out page.html
Enter fullscreen mode Exit fullscreen mode

github.com/Saketh-Labs/InsightPilot-AI

The README covers creating the bucket, and every gotcha above in more detail.

References

Top comments (0)