Context: IplanRioPeriod: 2026
in production

GCP cost investigation and Billing Guard

From a fee that jumped over 6,000x to an automatic breaker for runaway APIs.

My role

I ran the investigation and wrote the report. Billing Guard is all mine, 15 of 15 commits.

R$ 128k
per year in projected savings
2.5x
gap between bytes read and billed, explained
1/h
cap on automatic shutoffs
SPAN 01 // CONTEXT

Problem

After a Google pricing change, one project's Cloud Storage transfer fee went from cents to more than R$ 10k a month. None of the internal theories matched the numbers.

SPAN 02 // IMPLEMENTATION

Solution

I joined billing data with the job INFORMATION_SCHEMA across several projects and found the cause, dbt runs with 23 models in parallel reading external Parquet in a multi-region bucket from a single region. I also explained why billed bytes were 2.5x what BigQuery reported, since the Storage Read API pulls whole row groups. Google's product team confirmed it.

SPAN 03 // DETAILS

Highlights

  • Billing Guard, in Go on Cloud Run, takes cost anomalies from Pub/Sub. During business hours it posts to Discord. Outside them it checks for live traffic in Cloud Monitoring and disables the API.
  • Split IAM roles. The service can only disable, and only a person can re-enable.
  • Firestore dedup and leases, a one-shutoff-per-hour circuit breaker, protected projects and a service allowlist (GKE is never touched).
SPAN 04 // OUTCOME [200 OK]

Result

The fix projects R$ 128.9k a year in savings, and Billing Guard covers every project in the organization.

Quick actionsSwitch language to Português (PT-BR)
PT-BR
Quick actionsToggle light / dark theme
THEME
Quick actionsDownload résumé in Portuguese (PDF)
PDF · PT-BR
Quick actionsDownload résumé in English (PDF)
PDF · EN
Quick actionsCopy email address (fredzolio.dev@gmail.com)
COPY
NavigationProduction services and featured work
#servicos
NavigationAll projects
/en/projects/
NavigationCareer timeline
#carreira
NavigationTalks, hiring, documentation & open source
#atuacao
NavigationSkills & tooling
#stack
NavigationAcademic background, courses & languages
#formacao
NavigationContact & résumé
#contato
Projects & case studiesRio Queue
IplanRio · in production
Projects & case studiesPublic service search and recommendations
IplanRio · in production
Projects & case studiesCourses, jobs and employability API
IplanRio · in production
Projects & case studiesSuperApp load test
IplanRio · internal
Projects & case studiesNota Carioca data pipelines
IplanRio · in production
Projects & case studiesGCP cost investigation and Billing Guard
IplanRio · in production
Projects & case studiesEAí gateway and the city's MCP server
IplanRio · in production
Projects & case studiesCoding agent platform for developers
IplanRio · internal
Projects & case studiesAgents for infrastructure operations
IplanRio · internal
Projects & case studiesCity chatbot integrations
IplanRio · in production
Projects & case studiesGo email worker
IplanRio · in production
Projects & case studiesExecutive meeting room displays
IplanRio · in production
Projects & case studiesAlliomed
Vizo · in production
Projects & case studiesMaestro, a coding agent delivery pipeline
Vizo · internal
Projects & case studiesProventus
Vizo · in use by customers
Projects & case studiesSienge SaaS RPA
Vizo · sold
Projects & case studiesAWS infrastructure assessment
Vizo · client work
Projects & case studiesPLANEHAB Nosso Bairro
Freelance · live
Projects & case studiesConecta Solar
Freelance · live
Projects & case studiesVardis
Freelance · client work
Projects & case studiesLivinHub
Freelance · client work
Projects & case studiesNDC Nexus
New Data Company · prototype
Projects & case studiesWhatsApp group monitor
New Data Company · prototype
Projects & case studiesInternal ERP
New Data Company · internal
Projects & case studiesJungle Wallet
Personal · open source
Projects & case studiesZolioLab
Personal · internal
Projects & case studiesOSCE Cirurgia
Personal · prototype
Projects & case studiesENEM essay grading spike
Personal · experiment
Projects & case studiesGamePixzo
Personal · prototype
Projects & case studiesSurkai
Personal · open source