Skip to content

Real Infrastructure Testing

balakrishnagatla edited this page Nov 29, 2026 · 1 revision

Real Infrastructure Testing

Simulated clouds prove the logic; real ones prove it works. Both providers marked stable have been run against real infrastructure.

AWS: a real account

Setup. A fresh AWS account in us-east-2. demo/sandbox-tofu planted five resources, then demo/push_errors.py wrote errors to a log group.

Scan with read-only credentials:

Planted Discovered
CloudWatch alarm in ALARM ✅ reliability alert, likely cause: the PutMetricAlarm call that created it
60 errors in a log group ✅ reliability alert with the log lines
Unused Elastic IP ✅ $3.65/mo, with the release command
Unattached 20 GiB gp3 volume ✅ $1.60/mo, owner read from tags
Volume with no tags ✅ ownership gap

5 of 5 found. After tofu destroy, the next scan showed 5 resolved and $5.25/mo of cost savings captured.

Bugs it found that simulated data couldn't:

  1. CloudShell sends SendHeartBeat events constantly. They showed up as the "likely cause" of the alarm. Fix: filter console, sign-in, STS and CloudShell noise (#9).
  2. A change seconds after an alert was labelled "-1.0 min before" and ranked above earlier changes. Fix: clear "N min before/after it started" wording and prefer changes before the alert (#10).

Both have regression tests built from the real CloudTrail events.

Kubernetes: a real cluster in every CI run

The k8s-e2e job in CI:

  1. Creates a kind cluster.
  2. Applies demo/k8s/broken-shop.yaml: a crash-looping deployment, an OOM-killed pod, a pod that can't schedule, an unmounted claim, a released volume, a LoadBalancer with no backends, and an unlabelled deployment.
  3. Rolls out a config change (DB_POOL_MAX 50 -> 20) so there is a change to find.
  4. Scans using a token for the read-only service account only.
  5. demo/k8s/verify.py checks that all 7 expected discoveries appear, that healthy workloads are not flagged, and that the crash loop points at the rollout.

Result: 7 of 7, about $42/mo of cost savings opportunities, on every pull request.

One more real-world fix came from this: on newer Kubernetes, a crash-looping pod can be caught between restarts without the CrashLoopBackOff reason. Crash loops are now also detected from repeated failing exits (#11).

Reproduce it

# AWS (costs a few cents; destroy afterwards)
cd demo/sandbox-tofu && tofu init && tofu apply
python ../push_errors.py /demo/payment-api
INFRALENS_PROVIDERS=aws INFRALENS_REGIONS=us-east-2 infralens scan
tofu destroy && infralens scan     # shows resolved + savings captured

# Kubernetes (free, local)
kind create cluster
kubectl apply -f deploy/kubernetes/rbac.yaml -f demo/k8s/broken-shop.yaml
./demo/k8s/make-it-interesting.sh
infralens -p kubernetes scan

Clone this wiki locally