HomeCase studiesKubernetes FinOps Engine and Automated AWS Spend...

Case study · Seattle, United States

Kubernetes FinOps Engine and Automated AWS Spend Governance Platform

FinOps Kubernetes & Cloud Spend Governance

Engineering organizations running dense microservices across Amazon EKS and multi-account AWS estates often lose visibility into idle node slack, unallocated shared-cluster expenses, and expiring Savings Plans commitments. We built a cloud cost optimization platform anchored by Go telemetry collectors, direct AWS billing and compute APIs, and a PostgreSQL attribution ledger. The system correlates pod-level CPU and memory utilization against AWS Cost and Usage Reports in near real time, surfaces deterministic rightsizing patches, and enforces team-level budget guardrails without disrupting production workloads.

Industry
FinOps Kubernetes & Cloud Spend Governance
Solution
A FinOps governance and Kubernetes cost optimization platform built with Go, AWS APIs, and PostgreSQL for granular spend attribution, rightsizing recommendations, and commitment management.
Platforms
Web & API
Stack
Go · AWS APIs · PostgreSQL · Kubernetes · Prometheus · React
Location
Seattle, United States · delivered remotely
Role
Engineering, with the team behind for mobile and QA

Delivered remotely for a business based in Seattle, United States. Names withheld by agreement.

Project Overview

Cloud invoices rarely explain why infrastructure spend climbs faster than customer traffic. When engineering squads deploy workloads onto shared Amazon EKS clusters, native cloud billing tools stop at the virtual machine boundary, attributing node charges to a central platform account while hiding oversized pod requests, zombie load balancers, and underutilized Savings Plans inside opaque line items.

We designed and built a FinOps governance and Kubernetes cost optimization platform powered by Go, AWS APIs, and PostgreSQL. The system ingests raw AWS Cost and Usage Reports (CUR) alongside live cluster resource telemetry, reconciles amortized cloud discounts down to individual namespaces and Git-owned services, and produces safe, reviewable infrastructure optimizations.

Spend Blind Spots in Shared Clusters

Engineering and finance teams operating multi-account AWS estates struggled with four structural obstacles:

  • Shared-node attribution gaps: Multiple product teams schedule pods onto the same EC2 worker nodes, making raw AWS instance bills impossible to split cleanly across cost centers without pod-level telemetry.
  • Over-provisioned Kubernetes requests: Developers routinely pad CPU and memory requests to avoid evictions, forcing cluster autoscalers to spin up expensive nodes whose actual utilization remains low.
  • Amortization distortion: Floating Savings Plans and Reserved Instances shift dynamically across linked accounts each hour, causing naive chargeback spreadsheets to misreport which team actually triggered net spend increases.
  • Delayed anomaly detection: Waiting for monthly invoice reconciliation allows misconfigured NAT Gateways, runaway autoscaling loops, or orphaned EBS snapshots to burn budget silently for weeks.

Architectural Strategy

Our design centers on a unified FinOps attribution ledger that treats AWS billing exports and Kubernetes runtime metrics as a single relational timeline. Instead of polling metered Cost Explorer endpoints for every dashboard chart, Go ingestion pipelines pull daily CUR Parquet partitions from S3, enrich each resource with EC2 pricing catalogs and cross-account tags, and merge them with Prometheus pod-utilization windows inside partitioned PostgreSQL tables.

Rather than applying blind automated mutations to production clusters, the optimization engine operates on a human-reviewed, policy-bounded workflow. Rightsizing calculations respect container burst profiles, OOM-kill telemetry, and PodDisruptionBudgets, emitting concrete Terraform and Helm patch diffs that developers can inspect and merge through standard pull requests.

Core Capabilities

  • Amortized Multi-Account Cost Ledger: Ingests AWS CUR files across dozens of linked accounts, resolving net amortized rates after Savings Plans, Reserved Instances, and enterprise discount adjustments.
  • Kubernetes Namespace & Label Attribution: Splits EC2 compute, EBS storage, and shared network egress across namespaces, deployments, and custom ownership labels, including idle node slack tracking.
  • Safety-First Rightsizing Engine: Analyzes historical P95/P99 container usage and CPU throttling metrics to flag over-allocated requests while shielding stateful or latency-critical tiers.
  • Spot & Commitment Advisor: Evaluates workload interruption tolerance against AWS Spot placement scores and calculates optimal Savings Plan commitment coverage without locking in transient spikes.
  • Real-Time Spend Anomaly Guardrails: Monitors hourly cost velocity per service and environment, dispatching Slack or webhook alerts with exact offending AWS resource IDs when spend diverges from baseline forecasts.

Technical Architecture

Lightweight Go collectors deployed inside EKS clusters scrape kube-state-metrics and Prometheus utilization series, forwarding compacted pod-request and usage windows over TLS to a central Go ingestion API. Concurrently, scheduled Go workers assume cross-account IAM roles to download new CUR Parquet partitions and refresh EC2 On-Demand/Spot pricing tables from AWS APIs. The attribution engine normalizes both streams into daily partitioned PostgreSQL tables, pre-computing team rollups in Redis while serving interactive chargeback views and optimization diffs to a React web console.

Flow: AWS S3 CUR & AWS APIs + EKS Prometheus Collectors → Go Ingestion & Normalization Workers (Redis Rate Limits) → PostgreSQL Partitioned Attribution Ledger → Rightsizing & Anomaly Rule Engine → Go REST API → React FinOps Governance Console

Decoupling heavy Parquet ETL workers from the interactive API tier guarantees that multi-gigabyte billing imports never degrade dashboard query latency during finance closeout reviews.

Technology Stack

Category Technology detail
Ingestion & Policy Engine Go services processing CUR Parquet partitions, EKS telemetry, and rightsizing heuristics
Cloud Billing & Compute AWS APIs (CUR, Cost Explorer, EC2 Pricing, Compute Optimizer, and EKS)
Attribution Ledger PostgreSQL partitioned tables storing amortized hourly line items and namespace splits
Cluster Telemetry Kubernetes DaemonSets and Prometheus scrapers capturing actual pod CPU/memory footprints
FinOps Console React and TypeScript interface presenting chargeback views, anomaly alerts, and YAML diffs
Rate & Query Cache Redis caching AWS pricing matrices, API rate-limit tokens, and dashboard aggregations
Credential Federation AWS STS cross-account IAM AssumeRole with read-only billing and opt-in patch scopes
Scheduling & Workers Go worker pools executing staggered CUR imports and daily commitment-coverage audits

Engineering Trade-offs & Solutions

Engineering Challenge Solution & Trade-off
Handling late-arriving AWS CUR adjustments and floating Savings Plan reallocations Implemented idempotent partition replacement in PostgreSQL keyed by billing period and invoice status; trades brief re-aggregation runs during invoice finalization for penny-accurate historical reconciliation.
Avoiding expensive AWS Cost Explorer per-request charges during interactive filtering Stored normalized hourly line items in partitioned PostgreSQL tables backed by Redis rollups instead of proxying Cost Explorer; requires maintaining a Parquet ETL pipeline while keeping interactive exploration free and sub-second.
Preventing rightsizing recommendations from destabilizing burst-heavy microservices Weighted P99 utilization and Linux CFS throttling counters above simple averages and excluded workloads tagged with strict SLO annotations; surfaces fewer aggressive cuts in exchange for production safety.
Attributing unallocated cluster idle slack without distorting team accountability Split idle node capacity proportionally by requested resources per namespace while exposing an explicit unallocated platform line item; keeps teams accountable for over-requesting while highlighting bin-packing opportunities.

Security & Reliability

Because billing exports and cluster metadata reveal infrastructure topology and vendor pricing, access boundaries follow strict least-privilege defaults. Customer AWS accounts onboard through cross-account IAM roles restricted to read-only CUR S3 buckets, Describe/List compute APIs, and explicit ExternalId validation—no static access keys are stored.

Inside the Kubernetes cluster, the telemetry agent inspects only pod specs, resource requests, and Prometheus metrics, never reading application environment variables, secrets, or container payloads. Central PostgreSQL schemas enforce tenant isolation at both application middleware and row-level security policies. If an AWS API endpoint experiences transient throttling or an S3 CUR delivery stalls, Go workers apply exponential backoff with Redis-persisted checkpoints so partial imports resume cleanly without duplicating cost rows.

Performance & Scale

Multi-account AWS CUR archives can grow into tens of millions of hourly rows per billing cycle. To keep ingestion memory flat, Go workers stream Parquet row groups incrementally in bounded batches, resolving tag mappings in-memory before executing PostgreSQL COPY loads into range-partitioned tables.

Frequently queried FinOps dimensions—daily service spend, environment burn rates, and namespace efficiency scores—materialize into summary tables refreshed immediately after each partition load and cached in Redis. As a result, finance controllers and platform leads slice multi-quarter spend across hundreds of Kubernetes namespaces without triggering full table scans.

Operational Outcomes

Moving cost governance from ad-hoc spreadsheets into an automated Go, AWS APIs, and PostgreSQL platform reshaped collaboration between engineering and finance:

  • Transparent unit economics: Product teams trace exact cloud spend—including shared EKS nodes and amortized discounts—directly to their own namespaces and services.
  • Safe, actionable waste reduction: Engineers act on concrete Terraform and Helm rightsizing diffs backed by P99 utilization telemetry rather than generic cost-cutting memos.
  • Early anomaly containment: Hourly spend-velocity checks surface runaway autoscaling or orphaned volumes the same day they appear, before billing cycles close.
  • Disciplined commitment planning: Real-time coverage analytics give leadership clear visibility into steady-state compute baselines before purchasing multi-year Savings Plans.

01 — Questions

asked about this kind of project

Why combine AWS Cost and Usage Reports with live Prometheus metrics instead of relying on billing APIs alone?

AWS billing exports stop at the EC2 node or EBS volume boundary and cannot see which Kubernetes deployment requested excess CPU or left memory unused. Joining CUR line items with Prometheus pod-request and working-set series yields accurate per-namespace and per-label unit economics.

How does the PostgreSQL ledger handle amortized Reserved Instance and Savings Plan discounts accurately?

The Go ingestion pipeline normalizes CUR Parquet partitions into effective amortized hourly rates rather than list prices. When shared commitments float across linked AWS accounts, attribution rules preserve net amortized cost so teams see genuine cash impact rather than misleading on-demand figures.

How do you prevent automated rightsizing suggestions from starving latency-sensitive services during traffic spikes?

Recommendations evaluate multi-week P99 CPU throttling and memory OOM-kill headroom alongside pod disruption budgets. Stateful databases and burst-critical tiers are pinned to conservative safety margins, and engineers review generated Git pull-request diffs before any limit changes apply.

Why write the billing ingestion and cluster attribution workers in Go?

Parsing multi-gigabyte CUR Parquet files, streaming Prometheus range queries, and handling thousands of concurrent AWS API pages demand predictable memory bounds and fast goroutine concurrency. Go compiles to compact static binaries suitable for both central workers and lightweight in-cluster agents.

How are shared platform costs like NAT Gateways, ingress load balancers, and control planes allocated?

Platform teams configure weighted allocation rules in PostgreSQL that distribute shared infrastructure spend proportionally by namespace egress bytes, request volume, or node-hour consumption rather than dumping unallocated overhead into a generic bucket.

How does the platform guard against AWS Cost Explorer API fees and throttling across large organizations?

Routine analytics query the ingested CUR ledger in PostgreSQL instead of repeatedly hitting metered Cost Explorer endpoints. Direct AWS API calls are reserved for incremental pricing catalog refreshes and real-time instance-type availability checks, throttled via Redis token buckets.

03 — Similar project?

describe what is different about yours

Build yours.

Tell me what exists, what you need and the deadline. Fixed price for a defined scope, or $55/day (8–9 hours work) with a written plan first.

Solitaire Corporate Park, Makarba, Ahmedabad, Gujarat 380015, India · IST (UTC+5:30) · --:-- IST · Mon–Fri 09:00–18:00 IST · US & EU overlap daily

No newsletter, no CRM. Just a reply.