Case study · ERP

Cloud bill from $10k to under $1k a month

I cut an ERP's cloud bill from $10k to under $1k a month by moving 14 microservices into one modular monolith on Cloud Run.

  • 90%+lower cloud bill, from $10k to under $1k a month
  • 6 mindeploys, down from 45
  • 83%of invoices processed hands-free

Challenge

Oversized always-on instances, too many small microservices, large NAT and log costs, idle databases.

What I built

A modular monolith on Cloud Run, a smaller Cloud SQL instance, batch jobs as Cloud Run jobs, Cloud Storage lifecycle and log retention rules, all in Terraform; AI invoice extraction.

Stack

Python, Django, PostgreSQL (Cloud SQL), GCP, Terraform, GitHub Actions.

System design

Before, 14 microservices on their own VMs; after, one modular monolith on Cloud RunAfterBeforeinvoices uploadedmismatches14 microservicesCompute Engine VMsCloud NATthree zonesAlways-on databaseModular monolithCloud Run, scales down tozeroSmaller Cloud SQL instanceBatch jobsCloud Run jobs on CloudSchedulerPrivate Google AccessCloud Storagelifecycle rulesCloud Run functionasks an LLM to fill a fixedJSON schemaMatch against the purchaseorderA person

Before, 14 microservices each ran on their own Compute Engine VMs, behind Cloud NAT across three zones, with an always-on database. After, one modular monolith runs on Cloud Run, which scales down to zero when idle, and the database moved to a smaller Cloud SQL instance, sized from its measured CPU and memory use. Batch jobs moved to Cloud Run jobs on Cloud Scheduler. Private Google Access took most traffic off NAT, cutting NAT data-processing charges. Log retention dropped to 14 days, and Cloud Storage lifecycle rules move old files to cheaper tiers. Invoices uploaded to Cloud Storage trigger a Cloud Run function that asks an LLM to fill a fixed JSON schema, then match the result against the purchase order, sending mismatches to a person.

Results

  • 90%+ lower cost at the same or better latency
  • deploys from 45 to 6 minutes
  • 83% of invoices processed hands-free
Back to Work & Research