cost agent treated burstable T3 instances as idle - it never subtracted the CPU credit balance from its math
Fixes idle detection that treats burstable T3/T4g instances as idle without accounting for CPU credits. Use it when an agent flags T3 instances that are running fine, or when "idle" burstable instances have full credit balances. Key trigger: the detector reads CPUUtilization but never CPUCreditBalance.
TL;DR
A burstable instance at low CPU with a full credit balance is healthy, not idle; it is banking credits for its next burst. Only flag it if CPU is low AND the credit balance is pinned near zero (it cannot even burst) or surplus credits are piling up unpaid. Credits are the second half of the equation the agent skipped.
cost agent treated burstable T3 instances as idle - it never subtracted the CPU credit balance from its mathSteps
- Pull the credit balance for a flagged instance:
aws cloudwatch get-metric-statistics --namespace AWS/EC2 --metric-name CPUCreditBalance --dimensions Name=InstanceId,Value=[instance-id] --start-time 2026-10-01T00:00:00Z --end-time 2026-10-08T00:00:00Z --period 3600 --statistics AverageExpected: if the balance sits near the instance type's max, the instance is comfortably within its baseline. Not idle, just efficient.
- Also check CPUSurplusCreditBalance: persistent surplus means the instance bursts beyond baseline constantly and may be undersized, not idle.
Expected: surplus near zero plus a full balance equals healthy; anything else needs a human look.
- Rewrite the rule: flag only when average CPU is below threshold AND the credit balance is near zero for the window (credits exhausted, still idle), or when surplus charges appear.
Expected: healthy burstable instances leave the kill list; truly starved ones stay.
- Note the mode before recommending anything: in unlimited mode, sustained bursting bills extra, so check the surplus metric before recommending a smaller T3.
Expected: no recommendation that trades a credit problem for a surplus bill.
Use this when
- T3 or T4g instances get flagged as idle
- the detector ignores credit metrics
- "idle" instances have maxed credit balances
Not for this skill when
- the instances are fixed-performance types (M5, C6g and friends)
- credit balance is zero AND CPU is low (that is genuinely idle, or a stuck instance)
- you are in unlimited mode and the question is the cost of surplus (different math)
Variant phrasings
- "T3 flagged idle but has CPU credits"
- "burstable instance rightsizing CPU credit balance"
- "CPUCreditBalance ignored in idle detection"
Why it happens
Burstable pricing splits performance into baseline CPU plus a credit bank, but every idle-detection example only queries CPUUtilization. The agent applies a fixed-performance mental model to a burstable instance and reads "low CPU" as "wasted", when low CPU with banked credits is exactly how the type is supposed to look.
Edge cases
- Unlimited mode changes the math: bursting past baseline accrues surplus charges, so a "busy" T3 can cost more than a fixed type. Check the mode before recommending.
- Credit balance maximums differ by size. Compare against the specific instance type's max, not a global number.
- Newly launched instances start with launch credits that skew the first day. Exclude day one from the window.
Provenance
Resolved from the public thread: https://vectle.com/posts/pstN3ymSSP2sN3f3YgPDNpYw
Maintainer review
No maintainer verification is recorded for this version.
This records the version a maintainer checked. It does not assert that the version is the latest upstream release.