GCP billing — baseline, improvements, forecast
Financial snapshot for Oter (LifeCommanderKMP) and Negodex on Google Cloud. Ops details and rollback steps live in gcp-cost-cuts.md.
Scope
| Project | ID | What runs there |
|---|---|---|
| Oter | oter-490318 | Ktor API (oter), Next.js web (oter-web), Cloud SQL oter-db, Artifact Registry |
| Negodex | negodex | Nest API (api), admin/web frontends; no Cloud SQL after 2026-05-25 (uses Oter’s instance) |
Billing may appear on one GCP billing account (combined invoice) or per project depending on how the account is linked. Use Billing → Reports → Group by: Project to split Oter vs Negodex when validating savings.
1. Previous billing (baseline)
Measurement period
| Field | Value |
|---|---|
| Period | 2026-04-07 → 2026-04-30 (~23 days) |
| Currency reported | COP (Colombian peso) |
| FX used below | ~4,100 COP/USD (derived from line items; use your invoice for exact rates) |
Line items (as reported)
| SKU | COP (23 days) | ~USD (23 days) | ~USD / month (× 30/23) | Primary driver |
|---|---|---|---|---|
| Cloud SQL | 144,875 | ~$35 | ~$46 | Postgres always-on (oter-db; possibly includes shared-account SQL if Negodex billed here) |
| Cloud Logging | 131,398 | ~$32 | ~$42 | Ingestion + storage; server at DEBUG, 30-day retention, no exclusions |
| Cloud Run | 32,044 | ~$8 | ~$10 | Scale-to-zero services; Oter API at 2 vCPU / 1 GiB |
| Artifact Registry | 258 | ~$0.06 | ~$0.08 | Negligible |
| Total (these SKUs) | 308,575 | ~$75 | ~$98 |
What drove each cost (before cuts)
Cloud SQL (~46 USD/mo projected)
- Instance
oter-db: tierdb-custom-1-3840, Postgres 18, 10 GB disk, backups enabled. - Separate instance
negodex-pgin projectnegodex(same tier) added ~$50–60/mo if billed on the same account or on Negodex’s project — not always visible in a single-project export.
Cloud Logging (~42 USD/mo projected)
- Largest avoidable cost. Root causes:
logback.xmldefaulted to DEBUG; Flyway, Postgres driver, and Ktor also at DEBUG.- Cloud Run deploy did not set
LOG_LEVEL=INFO. _Defaultbucket: 30-day retention.- No sink exclusions for health checks or DEBUG severity.
Cloud Run (~10 USD/mo projected)
- Already efficient (scale to zero on web). Oter API oversized at 2 CPU / 1 GiB.
- Windmill was never deployed on GCP (no spend; repo workflow would have cost ~$210/mo if deployed — see automation-options.md).
Artifact Registry
- Storage only; no material cost.
Baseline scenarios
| Scenario | Estimated total / month |
|---|---|
| A — April numbers = entire billing account (both apps, one SQL line item) | ~$98 |
B — April = oter-490318 only; Negodex SQL billed separately | ~$98 (Oter) + ~$50–60 (Negodex SQL) ≈ $148–158 |
Confirm which scenario applies in Billing → Reports → Group by: Project for April.
2. Improvements applied (2026-05-25)
| # | Change | Est. monthly savings | Risk | Status |
|---|---|---|---|---|
| 1 | Logging: LOG_LEVEL=WARN, logback WARN defaults, live oter updated | $25–35 | Low | Done |
| 2 | Logging (GCP): retention 1d; exclusions (health, DEBUG, INFO/NOTICE, Cloud Run below ERROR) on oter-490318 + negodex | → ~$0 (free tier) | Low — less visibility | Done |
| 3 | Oter API: Cloud Run 1 vCPU / 512 MiB (was 2 / 1 GiB) | $2–4 | Low — monitor cold starts | Done |
| 4 | Negodex SQL: myecommercedb on oter-db; deleted negodex-pg | $50–60 | Medium — PG16→18 migration; smoke-test app | Done |
| 5 | Artifact Registry: cleanup policy (keep 5 tags; delete untagged >30d) | ~$0 (prevents growth) | Low | Done |
| 6 | Windmill: repo removed; never on GCP | $0 today; ~$210 avoided if deployed | — | Done (repo) |
Technical summary
Oter (oter-490318)
- Logging and CPU/RAM: workflow + live revision
oter-00033-jb2. - Redeploy via Publish Server Release after merge so the Docker image includes hardened
logback.xml. oter-dbstilldb-custom-1-3840; backups already 7 retained / 7-day transaction logs.
Negodex (negodex)
- DB host secret →
/cloudsql/oter-490318:us-east1:oter-db. apiCloud Run attached to shared instance;api-runtime@negodexgrantedroles/cloudsql.clientonoter-490318.negodex-pginstance deleted after successful restore and Nest startup.
Not changed yet (deferred)
- Downgrade
oter-dbmachine tier (wait 48h stable dual-app load). - Drop legacy database
oteronoter-dbif confirmed unused.
Full runbook: gcp-cost-cuts.md.
3. Expected billing (forecast)
Estimates are ranges until one full billing cycle (7–30 days) after 2026-05-25. Traffic and cross-project billing grouping affect actuals.
By SKU (monthly USD)
| SKU | Before (scenario A) | Before (scenario B) | After (expected) | Notes |
|---|---|---|---|---|
| Cloud SQL | ~$46 | ~$96–106 | ~$46–52 | One instance (oter-db) for both apps; slight load increase vs Oter-only |
| Cloud Logging | ~$42 | ~$42 | ~$0–3 | WARN app logs + ingest exclusions; aim for under 50 GiB/mo free |
| Cloud Run | ~$10 | ~$10–15 | ~$7–9 | Oter API smaller; Negodex unchanged |
| Artifact Registry | ~$0 | ~$0 | ~$0 | Cleanup policy |
| Total | ~$98 | ~$148–158 | ~$22–38 (A) or ~$57–67 (B) |
Scenario A — April total was ~$98 (combined view)
| USD / month | |
|---|---|
| Previous | ~$98 |
| Expected | ~$22–38 |
| Savings | ~$60–76 (~61–78%) |
Largest drivers: logging cut + removal of second SQL instance (if it was already inside the same $46 SQL line, savings show up as lower SQL growth or a second project dropping off — verify in console).
Scenario B — Negodex SQL was extra (~$50–60/mo)
| USD / month | |
|---|---|
| Previous (Oter + Negodex) | ~$148–158 |
| Expected | ~$63–73 |
| Savings | ~$75–95 (~50–60%) |
COP reference (at ~4,100 COP/USD)
| COP / month (approx.) | |
|---|---|
| Previous (scenario A) | ~402,000 |
| Expected (scenario A) | ~115,000–185,000 |
| Previous (scenario B) | ~607,000–648,000 |
| Expected (scenario B) | ~258,000–299,000 |
4. How to verify actuals
- Open GCP Billing → Reports.
- Set range: first full month after 2026-05-25.
- Group by: SKU — compare Cloud Logging, Cloud SQL, Cloud Run to tables above.
- Group by: Project — confirm
negodexhas no Cloud SQL line item; SQL spend should sit underoter-490318. - Optional: export CSV and archive next to this doc (e.g.
docs/infra/billing-exports/YYYY-MM.csv).
Success criteria
| SKU | Target vs April baseline |
|---|---|
| Cloud Logging | >90% decrease (ideally $0 within free tier) |
| Cloud SQL | ~50% decrease if two instances before; flat ~$46–52 if one shared instance already in baseline |
| Cloud Run | ~10–30% decrease on Oter project |
5. Near-zero Cloud Logging (2026-05-25 update)
GCP bills $0 for the first 50 GiB/month of log ingestion (then ~$0.50/GiB). To get close to $0:
| Layer | What we did |
|---|---|
| Application | LOG_LEVEL=WARN — no routine INFO/DEBUG to stdout |
| Ingest exclusions | Do not store Cloud Run logs below ERROR; drop INFO/NOTICE/DEBUG and health probes |
| Retention | 1 day on _Default (less storage cost if you ever exceed free tier) |
Trade-off: Logs Explorer shows mostly errors for Cloud Run. For a short investigation:
gcloud run services update oter --region=us-east1 --project=oter-490318 --update-env-vars=LOG_LEVEL=INFO
# when done:
gcloud run services update oter --region=us-east1 --project=oter-490318 --update-env-vars=LOG_LEVEL=WARNNegodex: same sink rules on project negodex; lower Nest logger level in the Negodex repo if INFO lines remain high.
6. Future levers (not in current forecast)
| Lever | Potential savings | When |
|---|---|---|
Downgrade oter-db tier after 48h stable | $0–15/mo | After Negodex + Oter verified |
Drop unused DB oter | Disk/admin only | After backup + confirm unused |
Negodex web minScale=1 → 0 if acceptable | $1–3/mo | Product decision (cold start on web) |
| Deploy Windmill on Cloud Run worker pools | +$210/mo | Do not without automation-options.md |
Related
- gcp-cost-cuts.md — applied changes, rollback, smoke tests
- gcp-server-cloud-run.md — Oter API deploy
- gcp-web-cloud-run.md — Oter web deploy
- automation-options.md — automation cost comparison