How Do You Monitor the EC2 CPU Credit Balance?
Monitoring the CPU credit balance of a burstable general-purpose instance in Amazon EC2 is done primarily through Amazon CloudWatch metrics, which track earned and consumed credits in five-minute intervals. This article explains how CPU credits work, lists the specific CloudWatch metrics required for tracking performance on T-series instances, demonstrates how to view credit balances in the AWS Management Console and AWS CLI, and outlines how to configure CloudWatch alarms to prevent unexpected performance throttling or surplus charges.
Understanding CPU Credits on Burstable Instances
Amazon EC2 T-series instances (such as T2, T3, T3a, and T4g) are designed to provide a baseline level of CPU performance with the ability to burst above that baseline when workloads demand additional compute capacity. This mechanism is governed by CPU credits.
One CPU credit represents the performance of a full CPU core (vCPU) running at 100% utilization for one minute. Equivalent combinations of vCPUs, utilization, and time also equal one CPU credit. The mathematical relationship for CPU credit consumption or accrual is defined as:
\[\text{CPU Credits} = \text{Number of vCPUs} \times \frac{\text{CPU Utilization Percentage}}{100} \times \text{Time in Minutes}\]
For example, one vCPU running at 50% utilization for two minutes consumes:
\[1 \times \frac{50}{100} \times 2 = 1\text{ CPU Credit}\]
When an instance runs below its baseline CPU utilization, it earns more credits than it consumes, and the net difference is added to the CPU credit balance up to a maximum cap determined by the instance size. When the instance runs above its baseline utilization, it spends accrued credits from its balance to burst.
Instance behavior when the credit balance reaches zero depends on the configured credit specification:
- Standard Mode: When the
CPUCreditBalancedrops to zero, the instance's CPU utilization is throttled back down to its baseline level, which can cause severe application latency or timeouts. - Unlimited Mode: When the
CPUCreditBalancereaches zero, the instance continues to burst as needed by spending surplus credits. If the instance remains above baseline on average over a 24-hour period, AWS bills for the accruedCPUSurplusCreditBalance.
Key CloudWatch Metrics for CPU Credits
Amazon EC2 automatically sends credit metrics to Amazon CloudWatch
every five minutes at no additional charge under the
AWS/EC2 namespace. You do not need to install the
CloudWatch Agent to monitor CPU credits.
CPUCreditUsage: The number of CPU credits spent by the instance during the measurement period. This metric identifies when and how heavily your workload is bursting.CPUCreditBalance: The number of earned CPU credits that an instance has accrued since it was launched or started. Credits accrue up to the instance type's maximum cap and expire 24 hours after they are earned.CPUSurplusCreditBalance: The number of surplus credits that have been spent by an unlimited instance when itsCPUCreditBalancewas zero.CPUSurplusCreditsCharged: The number of spent surplus credits that are not paid down by earned credits over a 24-hour period and therefore incur an additional charge.
Monitoring CPU Credits via the AWS Management Console
You can view real-time and historical CPU credit charts directly in the Amazon EC2 or Amazon CloudWatch console.
Using the EC2 Console
- Open the Amazon EC2 console and navigate to Instances in the left navigation pane.
- Select the target T-series instance (e.g.,
t3.medium,t4g.small). - Click the Monitoring tab in the lower details pane.
- Scroll through the displayed CloudWatch graphs to locate CPU credit balance (count), CPU credit usage (count), and CPU surplus credit balance (count).
- Use the time range selector at the top right of the Monitoring tab to inspect trends over the last 1 hour, 3 hours, 12 hours, or several days.
Using the CloudWatch Console
- Open the Amazon CloudWatch console and select All metrics under Metrics in the navigation pane.
- Select the EC2 namespace, then choose Per-Instance Metrics.
- In the search bar, filter by your InstanceId and
type
CPUCredit. - Check the boxes next to
CPUCreditBalance,CPUCreditUsage, andCPUSurplusCreditBalance. - Switch to the Graphed metrics tab and set the Statistic to Average and the Period to 5 Minutes for the most accurate representation of the credit pool.
Monitoring CPU Credits Using the AWS CLI
For automated scripts, terminal diagnostics, or external monitoring
integrations, use the aws cloudwatch get-metric-statistics
command to query the CPUCreditBalance of a specific
instance.
Run the following command, replacing i-0123456789abcdef0
with your EC2 instance ID and adjusting the --start-time
and --end-time timestamps in ISO 8601 format:
aws cloudwatch get-metric-statistics \
--namespace AWS/EC2 \
--metric-name CPUCreditBalance \
--dimensions Name=InstanceId,Value=i-0123456789abcdef0 \
--start-time 2026-11-15T08:00:00Z \
--end-time 2026-11-15T10:00:00Z \
--period 300 \
--statistics AverageThe command returns a JSON payload containing the data points at five-minute (300-second) intervals:
{
"Label": "CPUCreditBalance",
"Datapoints": [
{
"Timestamp": "2026-11-15T09:50:00+00:00",
"Average": 144.0,
"Unit": "Count"
},
{
"Timestamp": "2026-11-15T09:55:00+00:00",
"Average": 141.6,
"Unit": "Count"
}
]
}To verify whether your instance is currently configured as
standard or unlimited, run the
describe-instance-credit-specifications command:
aws ec2 describe-instance-credit-specifications \
--instance-ids i-0123456789abcdef0Setting Up CloudWatch Alarms for Proactive Monitoring
Relying on manual console checks can leave workloads vulnerable to unexpected throttling or billing spikes. You should configure Amazon CloudWatch alarms to notify your operations team via Amazon SNS when credit thresholds are breached.
Alarm for Standard Mode Instances (Preventing Throttling)
If your instance runs in standard mode, create an alarm
that triggers when CPUCreditBalance falls below a safe
reserve (for example, 20% of the instance's maximum credit cap, or a
flat threshold such as 20 credits) for three consecutive 5-minute
periods:
aws cloudwatch put-metric-alarm \
--alarm-name "Low-EC2-CPU-Credit-Balance" \
--alarm-description "Alert when EC2 CPU credit balance drops below 20" \
--metric-name CPUCreditBalance \
--namespace AWS/EC2 \
--statistic Average \
--period 300 \
--threshold 20 \
--comparison-operator LessThanThreshold \
--dimensions Name=InstanceId,Value=i-0123456789abcdef0 \
--evaluation-periods 3 \
--alarm-actions arn:aws:sns:us-east-1:123456789012:OperationsAlertsAlarm for Unlimited Mode Instances (Preventing Unexpected Charges)
If your instance runs in unlimited mode (the default for
T3, T3a, and T4g), CPUCreditBalance dropping to zero will
not throttle the CPU, so monitoring CPUCreditBalance alone
is insufficient for cost control. Instead, create an alarm on
CPUSurplusCreditBalance or
CPUSurplusCreditsCharged to detect when the instance is
sustaining CPU usage above its baseline and accumulating extra
charges:
aws cloudwatch put-metric-alarm \
--alarm-name "High-EC2-CPU-Surplus-Credits" \
--alarm-description "Alert when EC2 instance accumulates surplus credit charges" \
--metric-name CPUSurplusCreditsCharged \
--namespace AWS/EC2 \
--statistic Average \
--period 300 \
--threshold 1 \
--comparison-operator GreaterThanOrEqualToThreshold \
--dimensions Name=InstanceId,Value=i-0123456789abcdef0 \
--evaluation-periods 2 \
--alarm-actions arn:aws:sns:us-east-1:123456789012:BillingAlertsIf an unlimited instance consistently triggers
CPUSurplusCreditsCharged alarms, evaluate whether scaling
up to a larger T-series size or migrating to a fixed-performance
M-series or C-series instance is more cost-effective.