aws-bleed
5-second read-only scan for expensive AWS hidden taxes: NAT Gateway traffic to S3/DynamoDB without free gateway endpoints, CloudWatch Logs with infinite retention, gp2 and orphaned EBS volumes, idle Elastic IPs, and stale snapshots, complete with USD/month estimates and a fix-bleed.tf Terraform patch.
Install
bunx aws-bleed
npx aws-bleed
# or install in your project / globally
bun add -d aws-bleed
npm i -D aws-bleed
JSR:
bunx jsr add @kanchingyg/aws-bleed
npx jsr add @kanchingyg/aws-bleed
go install github.com/kanchingyg/aws-bleed@latest
The core engine is Go (main.go, internal/). TypeScript under src/*.ts is included for npx / bunx / JSR usage and MCP bridge helpers when no native binary is present.
Quick start
npx aws-bleed
bunx aws-bleed
npx aws-bleed --patch fix-bleed.tf --allow-write
npx aws-bleed --mcp
What you get
| Finding | Fix in patch |
|---|---|
| NAT in VPC without S3/DynamoDB gateway endpoints | aws_vpc_endpoint (Gateway) |
Log groups with retentionInDays = null |
retention_in_days |
gp2 volumes |
gp3 migration block |
available volumes / idle EIPs / old snapshots |
Comments + CLI cleanup hints |
MCP + local models
npx aws-bleed --mcp
bunx aws-bleed --mcp
Use summarize_exec_report with --model ollama/llama3.2 (or any OpenAI-compatible local server) so cost data stays on your machine.
Requirements
- Node 18+ or Bun for
npx/bunx, or Go 1.22+ for native CLI - AWS credentials with read-only
Describe*/List*(no writes unless you pass--allow-writefor patch files)
MCP Tools Reference
| Tool | Mutates | Description |
|---|---|---|
scan_aws_bleed |
false |
Run read-only FinOps checks across NAT Gateways, VPC Gateway Endpoints, EBS volumes, Elastic IPs, snapshots, and CloudWatch Log Groups. |
generate_finops_patch |
false |
Render a terraform or cloudformation remediation patch (aws_vpc_endpoint, gp3 migration, log retention). |
write_finops_patch |
true |
Write the generated FinOps patch file to disk inside the workspace (requires --allow-write). |
summarize_exec_report |
false |
Format a concise monthly waste report suitable for engineering review. |
Editor and Agent Integration
Cursor (.cursor/mcp.json)
{
"mcpServers": {
"aws-bleed": {
"command": "npx",
"args": ["-y", "aws-bleed", "--mcp"]
}
}
}
Claude Code CLI
claude mcp add aws-bleed -- npx -y aws-bleed --mcp
Programmatic Usage (JSR / TypeScript)
import * as bridge from "jsr:@kanchingyg/aws-bleed/bridge";
Runtime Safety and Guardrails
- Stdio frame isolation: When
--mcpis active,hijackStdoutForMcp()redirects accidentalconsole.logcalls tostderrso JSON-RPC 2.0 frames onstdoutnever corrupt. - Read-only by default: Mutating tools (
mutates: true) are blocked in--dry-runmode and require explicit--allow-writeauthorization. - Loop breaker: Repeated identical
(toolName, args)invocations are hashed with SHA-256 and halted after 3 consecutive repeats to prevent runaway agent loops. - Context budget truncation: Tool outputs are middle-truncated (
60%head /40%tail) scaled to the probed local modeln_ctx(Ollama/api/show, llama.cpp/props, vLLM/v1/models). - Secret redaction and path normalization: AWS keys (
AKIA*,ASIA*), bearer tokens, andsk-*keys are scrubbed before returning tool output, and Windows drive paths (C:\...) translate cleanly to/mnt/c/...when WSL mode is enabled.