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.