Last week I wired a single frontier LLM to wide AWS MCP (Model Context Protocol) servers for a 17-region FinOps audit and hit two failures before lunch. Replaying verbose JSON tool schemas and raw AWS CLI output across 17 regions burned input tokens faster than an idle NAT Gateway costs — and our first headless zsh CI run silently expanded $0.60/hr into -zsh.60/hr before the CLI even parsed the prompt.
Disclosure: I am a Founding Engineer working on TalkOps (open-source, Apache 2.0), the CLI runtime used in the optional agentic sections below. Every bash sweep, IAM policy, Karpenter v1 manifest, Terraform diff, and S3 bucket policy below runs standalone with standard AWS, Kubernetes, and open-source IaC tools. Editorial note: AI-assisted drafting and editing (some_ai) were used; all commands and sandbox runs were verified by the author.
Start With Plain AWS CLI & Karpenter v1 (Zero LLM Tokens)
If you only need a single-account inventory sweep or static PR cost diff, keep LLMs out of the loop. Native aws CLI + jq, AWS Cost Explorer, infracost, tflint, checkov, opencost, and kubecost run faster, burn zero tokens, and behave deterministically.
Here are the four quiet AWS EKS and VPC leaks that catch teams off guard most often (note how EKS Extended Support jumps 6x once a cluster passes AWS's 14-month standard window, and how NAT Gateways bill $32.85/mo each even at zero traffic):
| AWS Waste Vector | Published AWS Pricing Impact | Read-Only Runtime Check | Shift-Left Terraform / K8s Fix |
|---|---|---|---|
| EKS Extended Support | $0.60/hr vs. $0.10/hr standard control plane (after 14 mo) | aws eks describe-cluster (upgradePolicy.supportType) | Upgrade cluster_version before standard support ends |
| Redundant Non-Prod NAT Gateways | $0.045/hr base per AZ (~$32.85/mo) even when idle | aws ec2 describe-nat-gateways + CloudWatch BytesOutToDestination | Set single_nat_gateway = true in non-prod (saves $65.70/mo across 3 AZs) |
| Unattached EBS Volumes | $0.08/GB-mo (gp3) or $0.10/GB-mo (gp2) while available | aws ec2 describe-volumes --filters Name=status,Values=available | Set delete_on_termination = true and reclaimPolicy: Delete |
| Fragmented EKS Node Groups | Underutilized EC2 capacity stranded across AZs | kubectl get nodepools -o yaml | Set Karpenter v1 WhenEmptyOrUnderutilized and disruption budgets |
Scope audit credentials to a strict read-only IAM policy with zero write or delete actions:
Click to expand least-privilege Read-Only IAM Policy for FinOps Sweeps{ "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "ec2:DescribeRegions", "ec2:DescribeNatGateways", "ec2:DescribeVolumes", "eks:ListClusters", "eks:DescribeCluster", "cloudwatch:GetMetricStatistics", "ce:GetCostAndUsage", "s3:ListAllMyBuckets", "s3:GetBucketVersioning", "s3:ListBucketVersions" ], "Resource": "*" } ] } Run one read-only bash sweep across all enabled AWS regions to inspect EKS Extended Support status ($0.60/hr vs. $0.10/hr standard), active NAT Gateways ($0.045/hr base), and unattached EBS volumes stuck in available state:
#!/usr/bin/env bash set -euo pipefail for r in $(aws ec2 describe-regions --query 'Regions[].RegionName' --output text); do echo "=== $r ===" for c in $(aws eks list-clusters --region "$r" --query 'clusters[]' --output text); do aws eks describe-cluster --region "$r" --name "$c" \ --query 'cluster.{Cluster:name,Version:version,Support:upgradePolicy.supportType}' --output table done aws ec2 describe-nat-gateways --region "$r" --filter Name=state,Values=available \ --query 'NatGateways[].[NatGatewayId,VpcId,SubnetId]' --output table aws ec2 describe-volumes --region "$r" --filters Name=status,Values=available \ --query 'Volumes[].[VolumeId,Size,VolumeType,AvailabilityZone]' --output table done Never remove a NAT Gateway from inventory status alone — verify 7-day outbound traffic via CloudWatch BytesOutToDestination first (a Sum of 0 over 604800 seconds confirms zero outbound egress):
END_TIME=$(date -u +"%Y-%m-%dT%H:%M:%SZ") START_TIME=$(date -u -v-7d +"%Y-%m-%dT%H:%M:%SZ" 2>/dev/null || date -u -d '7 days ago' +"%Y-%m-%dT%H:%M:%SZ") aws cloudwatch get-metric-statistics --region ap-south-1 \ --namespace AWS/NATGateway --metric-name BytesOutToDestination \ --dimensions Name=NatGatewayId,Value="nat-0123456789abcdef0" \ --start-time "$START_TIME" --end-time "$END_TIME" --period 604800 --statistics Sum --output json On AWS EKS clusters running Karpenter v1, pair billing sweeps with NodePool disruption budgets so idle nodes consolidate cleanly without churning pods during business hours. Keep in mind that involuntary 2-minute EC2 Spot interruptions (handled via EventBridge + SQS) bypass voluntary NodePool budgets, so stateful or latency-sensitive workloads still need explicit PodDisruptionBudget objects:
apiVersion: karpenter.sh/v1 kind: NodePool metadata: name: general-compute spec: template: spec: nodeClassRef: group: karpenter.k8s.aws kind: EC2NodeClass name: default requirements: - key: karpenter.sh/capacity-type operator: In values: ["spot", "on-demand"] disruption: consolidationPolicy: WhenEmptyOrUnderutilized consolidateAfter: 5m budgets: - nodes: "10%" - nodes: "0" schedule: "0 9 * * mon-fri" duration: 8h reasons: ["Underutilized"] Verify active disruption policies directly via kubectl:
kubectl get nodepools -o custom-columns=NAME:.metadata.name,POLICY:.spec.disruption.consolidationPolicy,AFTER:.spec.disruption.consolidateAfter Fixing MCP Tool-Schema Bloat With Sub-70ms Tier Routing
Single scripts lose steam when you need cross-boundary triage: sweeping 17 live AWS regions, correlating empty or drifted runtime inventory against local Terraform modules, and checking EKS manifests together. Wiring one frontier LLM to a kitchen-sink MCP server fails on token math because every describe-nat-gateways, describe-volumes, and list-clusters response piles up in conversation history while routine pagination burns flagship reasoning tokens.
Two practical configuration controls keep multi-region agent spend predictable:
- Mount narrow, read-only MCP tool surfaces per task: Isolate FinOps sweeps to read-only inspection servers instead of loading every cloud mutation tool into every prompt — scoping a FinOps subagent strictly to read-only AWS and Terraform inspection tools rather than cluster-admin or state-write MCP servers.
- Route simple checks off frontier models and pin cached prompt prefixes: Instead of sending every regional
describecall to a frontier model, split providers and models across three tiers inside/pool(Model Pool Configuration (multi), withQuick Preset,Save Pool, andReset Defaultscontrols):Fast Tier (Tier 0)handles routine lookups anddescribepagination,Standard Tier (Tier 1)handles single-domain operations and Terraform correlation, andPowerful Tier (Tier 2)is reserved for multi-agent planning and cross-region synthesis:

The /pool Model Pool Configuration modal splits Fast Tier (Tier 0), Standard Tier (Tier 1), and Powerful Tier (Tier 2) across separate models so routine describe calls never hit frontier pricing.
In practice, Jev Smart Mode routes model tiers in under 70ms, cutting token costs by 80-90% on simple checks, while prompt caching reuses static system prompts and tool definitions across region hops instead of re-billing them every turn. On a populated multi-region test, our published reference run audited 17 AWS regions across 53 tool calls for $0.36 with 77% cache hit using aws-finops-engineer.
Sandbox Catch: 17 Clean Regions, One $65.70/mo Terraform NAT Bug
Runtime AWS inventory checks share one blind spot: they only catch waste after terraform apply starts metering hourly charges.
The TUI recording below shows aws-finops-engineer running read-only regional AWS checks inside Smart Mode while reporting tool-call progress and prompt-cache efficiency:
![]()
Live Smart Mode TUI recording of aws-finops-engineer sweeping AWS regions read-only with tool progress and prompt-cache metrics.
When I ran talkops --smart --read-only with aws-finops-engineer against a fresh 17-region sandbox (ap-south-1 primary), every runtime check confirmed 0 live EKS clusters, 0 active NAT Gateways, and 0 unattached EBS volumes. A runtime-only bash sweep stops there and exits green.
Because the run also inspected infra/terraform/eks/main.tf in the repository, it caught a shift-left VPC default before apply: the non-production EKS module enabled one_nat_gateway_per_az = true across 3 Availability Zones (3 × $0.045/hr × 730h = $98.55/mo idle base at AWS list pricing) instead of sharing one NAT Gateway ($32.85/mo base):
# infra/terraform/eks/main.tf — switch non-prod from 3 NAT Gateways to 1 (saves $65.70/mo AWS base cost) module "vpc" { source = "terraform-aws-modules/vpc/aws" version = "~> 5.0" name = "eks-nonprod-vpc" azs = ["ap-south-1a", "ap-south-1b", "ap-south-1c"] enable_nat_gateway = true single_nat_gateway = true # was: false one_nat_gateway_per_az = false # was: true (3 AZ NAT Gateways) } Switching non-prod environments to single_nat_gateway = true saves $65.70/mo per environment in published AWS NAT Gateway hourly fees before transfer charges, keeping per-AZ NAT isolation strictly for production failover SLAs. Verify the exact NAT Gateway count in your plan before merge:
terraform -chdir=infra/terraform/eks plan -no-color | grep -E "aws_nat_gateway|Plan:" Two Headless CI --rubric Gotchas We Hit Live
Moving FinOps audits into headless CI/CD (talkops -p ... --rubric --json) surfaced two sharp operational edges worth baking into any pipeline.
1. Unescaped $0.60/hr in zsh Double Quotes Expands $0 to -zsh
In zsh, currency figures inside double-quoted strings trigger shell positional expansion: $0.60/hr silently becomes -zsh.60/hr before the CLI even parses the prompt. Escape \$0.60/hr in double quotes or pass prompts via a single-quoted heredoc:
# BROKEN in zsh double quotes: $0 expands to "-zsh" -> "(-zsh.60/hr)" talkops --smart --read-only -a aws-finops-engineer \ -p "Flag EKS clusters on Extended Support ($0.60/hr vs $0.10/hr standard)" # SAFE in double quotes: escape \$0.60/hr talkops --smart --read-only -a aws-finops-engineer \ -p "Flag EKS clusters on Extended Support (\$0.60/hr vs \$0.10/hr standard)" # PREFERRED in CI: single-quoted heredoc prevents all shell expansion PROMPT=$(cat <<'EOF' Audit enabled AWS regions for EKS Extended Support ($0.60/hr vs $0.10/hr standard), idle NAT Gateways ($0.045/hr base), unattached EBS volumes, and infra/terraform/eks/main.tf. EOF ) 2. Why Fail-Closed --rubric Exited Non-Zero (criteria_unmet) on an Empty Account
Our initial --rubric required populated evidence rows for live EKS clusters, NAT traffic metrics, and right-sizing savings. Because every live resource count in our clean 17-region sandbox was genuinely 0, the fail-closed --rubric grader refused to fabricate rows — it wrote "status": "criteria_unmet" into audit.json and exited with code 2:
{ "schema_version": 1, "command": "run", "data": { "status": "criteria_unmet", "rubric_status": "max_iterations_reached" } } set +e talkops --smart --read-only -a aws-finops-engineer \ -p "$PROMPT" \ --rubric "Lists every affected live resource or confirms zero active resources across enabled regions, and flags non-prod multi-AZ NAT defaults in Terraform" \ --json > audit.json EXIT_CODE=$? set -e if [ "$EXIT_CODE" -ne 0 ]; then echo "Fail-closed rubric halted CI (exit=$EXIT_CODE): inspect audit.json for criteria_unmet" exit "$EXIT_CODE" fi That fail-closed non-zero exit (2) is the right default for CI gates: split rubrics so runtime checks explicitly accept verified zero-resource accounts when clean, while IaC checks fail PRs loudly whenever infra/terraform/eks/main.tf introduces redundant non-prod NAT Gateways.
Locking Down S3 .tfstate Buckets Before Any Cleanup Runs
The moment a FinOps workflow shifts from read-only auditing to deleting resources, blast radius spikes. A Terraform state bucket (.tfstate) is the live inventory map Terraform uses to manage your VPCs, Security Groups, and EKS clusters — yet because it has low request volume and zero public traffic, naive cleanup automation easily mistakes it for an unused bucket.
Because our sandbox had no unattached EBS volumes, I validated cleanup guardrails against S3 in ap-south-1, where the account held one active versioned Terraform state bucket (krayak-dev-8021-as1-terraform-tfstate). Always inspect versioning and active state keys read-only first:
aws s3api get-bucket-versioning --region ap-south-1 --bucket krayak-dev-8021-as1-terraform-tfstate aws s3api list-object-versions --region ap-south-1 --bucket krayak-dev-8021-as1-terraform-tfstate \ --query 'Versions[?ends_with(Key, `.tfstate`)].[Key,VersionId,IsLatest]' --output table Enforce state protection at the AWS IAM and S3 bucket-policy layer first, denying deletion for every principal except a break-glass admin role:
{ "Version": "2012-10-17", "Statement": [ { "Sid": "DenyTfstateDeletionExceptBreakGlass", "Effect": "Deny", "Principal": "*", "Action": ["s3:DeleteBucket", "s3:DeleteObject", "s3:DeleteObjectVersion"], "Resource": [ "arn:aws:s3:::krayak-dev-8021-as1-terraform-tfstate", "arn:aws:s3:::krayak-dev-8021-as1-terraform-tfstate/*" ], "Condition": { "StringNotLike": { "aws:PrincipalArn": "arn:aws:iam::123456789012:role/break-glass-state-admin" } } } ] } Verify the explicit deny policy is attached and blocks s3:DeleteObjectVersion for your audit role:
aws s3api get-bucket-policy --region ap-south-1 \ --bucket krayak-dev-8021-as1-terraform-tfstate --query Policy --output text | jq . aws iam simulate-principal-policy \ --policy-source-arn "arn:aws:iam::123456789012:role/finops-readonly-audit" \ --action-names s3:DeleteObject s3:DeleteObjectVersion s3:DeleteBucket \ --resource-arns "arn:aws:s3:::krayak-dev-8021-as1-terraform-tfstate/*" \ --query 'EvaluationResults[].[EvalActionName,EvalDecision]' --output table Treat a runtime write gate strictly as defense in depth on top of IAM and S3 bucket policies. Because TalkOps is open-source (Apache 2.0) and fail-closed on production writes by default, its execution layer inspects every tool call for production risk in under 100ms at zero prompt token cost.
In our ap-south-1 test against krayak-dev-8021-as1-terraform-tfstate, that guard caught the active versioned .tfstate objects before issuing aws s3api delete-objects and required explicit interactive confirmation, leaving 0 writes against AWS.
Where Static Tools Beat Any FinOps Agent
- Always-on spend tracking: AWS Cost Explorer Anomaly Detection and AWS Compute Optimizer run natively at zero token cost.
- Deterministic Terraform PR diffs & GitOps:
infracost,tflint,checkov, OPA/Conftest, andArgo CDcatch static attribute regressions and keep cluster state reconciled deterministically on every PR. - In-cluster EKS visibility & incident staples:
opencost,kubecost,kubectl,k9s,Prometheus/Alertmanager/Loki/Grafana, andRobustahandle real-time pod inspection, alerting, and namespace cost allocation without LLM loops. - Where MCP-backed FinOps agents fit: Cross-boundary investigations sweeping 17 AWS regions, correlating clean or drifted runtime state against
infra/terraform/eks/main.tfand KarpenterNodePoolmanifests under strict read-only IAM and fail-closed write boundaries.
Discussion & Source
Every bash loop, Karpenter NodePool manifest, Terraform fix, and S3 bucket policy above works standalone in any AWS + EKS CI pipeline. If you want to read the Apache 2.0 routing or write-gate code referenced in the walkthrough, the repository is here:
talkops-ai / talkops
Open-Source AI Platform for DevOps, SRE, Cloud, and Platform Engineering
TalkOps — Open-Source AI Platform for DevOps
Introduction • Features • Getting Started • GitHub Action • Docs • Contributing
Introduction
TalkOps is an open-source multi-agent platform for DevOps, SRE, Cloud, and Platform Engineering (Overview) that works directly with your existing local cloud CLIs (aws, kubectl, terraform, helm, az, gcloud)—so your cloud credentials never leave your environment.
Run TalkOps interactively in your terminal (talkops / ops), headlessly in CI/CD pipelines (talkops -p ...), or as a shared team and webhook server (talkops serve) backed by SQLite or PostgreSQL.
TalkOps in Action (65-Second Architecture & Incident Demo)
🔊 Unmute the player for studio narration, or watch muted with burned-in captions.
Features
Multi-Cloud and Kubernetes Operations
- Multi-Cloud Operations (
/cloud,/aws,/azure,/gcp): Switch between AWS accounts, Azure subscriptions, and GCP…
How is your team catching shift-left Terraform waste like multi-AZ non-prod NAT Gateways before terraform apply — static Infracost/OPA PR gates, scheduled AWS CLI sweeps, or fail-closed agentic audits? And what IAM or bucket-policy guardrails protect your S3 .tfstate buckets?
