Skip to main content
Glama

cost_signals

Analyze AWS cost signals from audit snapshots to identify spending patterns and optimize resource allocation for better budget management.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
snapshot_idYes

Implementation Reference

  • The cost_signals tool handler. Decorated with @mcp.tool for registration. Loads snapshot data and computes cost signals such as EC2 instance type counts, stopped instances, unattached EBS volumes in GB, and unassociated EIPs. Saves results to cost.json and returns them.
    @mcp.tool def cost_signals(snapshot_id: str) -> Dict[str, Any]: p = os.path.join(snapshot_dir(DATA_DIR, snapshot_id), "snapshot.json") snap = read_json(p) by_type: Dict[str, int] = {} unattached_gb = 0 unassoc_eips = 0 stopped_instances = 0 for region, blob in snap.get("ec2_by_region", {}).items(): for inst in blob.get("instances", []): t = inst.get("instance_type") or "unknown" by_type[t] = by_type.get(t, 0) + 1 if inst.get("state") == "stopped": stopped_instances += 1 for vol in blob.get("volumes", []): if not vol.get("attached_instance_id"): unattached_gb += int(vol.get("size_gb") or 0) for e in blob.get("eips", []): if not e.get("association_id") and not e.get("instance_id"): unassoc_eips += 1 out = { "ec2_instance_type_counts": dict(sorted(by_type.items(), key=lambda kv: kv[0])), "stopped_instances": stopped_instances, "unattached_ebs_gb": unattached_gb, "unassociated_eips": unassoc_eips, "note": "Tier-1 signals only (derived from inventory).", } write_json(os.path.join(snapshot_dir(DATA_DIR, snapshot_id), "cost.json"), out) return out

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/oldcoder01/aws-mcp-audit'

If you have feedback or need assistance with the MCP directory API, please join our Discord server