How Do Amazon EC2 T-Series CPU Credits Work?

Amazon EC2 burstable T-series instances operate using a CPU credit mechanism designed for workloads that do not constantly use the full capacity of their allocated processors. Each instance is assigned a baseline level of CPU performance and continually earns CPU credits at a fixed rate per hour based on its size. When an instance uses less CPU than its baseline, it accumulates these earned credits in a bucket up to a maximum cap. When the instance requires additional computing power to handle traffic spikes or intensive processing tasks, it spends the accumulated credits to burst above the baseline performance level. This system allows organizations to lower their cloud computing costs while maintaining the ability to scale performance on demand.

What Is a CPU Credit?

A single CPU credit represents the performance of a full processor core (vCPU) running at 100% utilization for one minute. However, this value is flexible and can be divided across multiple vCPUs or stretched over longer periods of lower utilization.

The mathematical relationship for a CPU credit is defined as:

\[\text{1 CPU Credit} = 1\text{ vCPU} \times 100\%\text{ Utilization} \times 1\text{ Minute}\]

Because utilization and time are inversely proportional for a single credit, the same credit can be consumed in different ways:

\[\text{1 CPU Credit} = 1\text{ vCPU} \times 50\%\text{ Utilization} \times 2\text{ Minutes}\]

\[\text{1 CPU Credit} = 2\text{ vCPUs} \times 25\%\text{ Utilization} \times 2\text{ Minutes}\]

Amazon EC2 tracks credit usage at a millisecond resolution, ensuring that even brief micro-bursts of activity accurately deduct only the exact fraction of a credit required.

Baseline Utilization and Credit Earning Rates

Every T-series instance size (such as t3.micro, t3.medium, or t4g.large) has a predefined baseline utilization percentage per vCPU. The baseline is the level of CPU utilization at which the net credit balance does not change—the instance earns credits at the exact same rate it spends them.

The number of credits an instance earns per hour is determined by its baseline percentage and the number of vCPUs:

\[\text{Credits Earned per Hour} = \text{Number of vCPUs} \times \text{Baseline Utilization} \times 60\text{ Minutes}\]

For example, consider an instance with \(2\text{ vCPUs}\) and a \(20\%\) (\(0.20\)) baseline utilization per vCPU:

\[\text{Credits Earned per Hour} = 2 \times 0.20 \times 60 = 24\text{ Credits}\]

Since credits are accrued continuously rather than in a single hourly lump sum, this instance earns \(0.4\text{ credits}\) every minute it is in the running state.

How Credit Accumulation Works

An instance accumulates credits whenever its actual CPU utilization falls below its baseline percentage. The net rate of accumulation per minute is calculated by taking the difference between the credits earned and the credits spent:

\[\text{Net Credits per Minute} = \left(\text{vCPUs} \times \text{Baseline Utilization}\right) - \left(\text{vCPUs} \times \text{Actual Utilization}\right)\]

If our \(2\text{-vCPU}\) instance with a \(20\%\) baseline is idling at \(5\%\) utilization across both vCPUs, the per-minute calculation is:

\[\text{Net Credits per Minute} = (2 \times 0.20) - (2 \times 0.05) = 0.40 - 0.10 = +0.30\text{ Credits}\]

Maximum Credit Balance Cap

Accrued credits do not accumulate infinitely. Every T-series instance has a maximum credit balance limit, which is equal to the total number of credits the instance can earn in a 24-hour period. Once the instance reaches this cap, any new credits earned while idling are discarded. For an instance earning \(24\text{ credits}\) per hour, the credit bucket is capped at:

\[\text{Maximum Credit Balance} = 24\text{ Credits/Hour} \times 24\text{ Hours} = 576\text{ Credits}\]

Accrued credits on modern T3, T3a, and T4g instances persist for seven days after an instance is stopped. If the instance is restarted within those seven days, its previous credit balance is restored. On older T2 instances, stopping the instance immediately clears the entire accrued balance.

How Credit Spending Works

When an application demands more CPU power than the baseline provides, the instance automatically draws from its accrued credit balance to burst up to \(100\%\) utilization across all available vCPUs.

Using the previous \(2\text{-vCPU}\) instance (\(20\%\) baseline), if a workload spikes to \(100\%\) utilization across both cores, the net credit change per minute is:

\[\text{Net Credits per Minute} = (2 \times 0.20) - (2 \times 1.00) = 0.40 - 2.00 = -1.60\text{ Credits}\]

If this instance starts with a full bucket of \(576\text{ credits}\), the duration it can sustain a continuous \(100\%\) CPU burst before exhausting its balance is:

\[\text{Burst Duration} = \frac{576\text{ Credits}}{1.60\text{ Credits/Minute}} = 360\text{ Minutes (6 Hours)}\]

Standard Mode vs. Unlimited Mode

What happens when an instance exhausts its entire credit balance depends on whether the instance is configured in Standard mode or Unlimited mode.

Standard Mode

In Standard mode, if an instance depletes its accrued credit balance, it can no longer burst above its baseline. Amazon EC2 gradually throttles the instance's CPU utilization down to its baseline level (for example, \(20\%\)). The instance remains capped at this baseline performance until demand drops below the baseline, allowing the instance to accumulate positive credits again.

  • Launch Credits: Older T2 instances in Standard mode receive an initial allotment of launch credits when first provisioned so they can burst immediately during boot sequences without waiting to accrue credits.

Unlimited Mode

In Unlimited mode (the default setting for T3, T3a, and T4g instances), an instance is never throttled down to its baseline when its credit bucket hits zero. Instead, it is allowed to spend surplus credits to maintain high CPU utilization for as long as needed.

When an instance spends surplus credits, two outcomes are possible over a rolling 24-hour period:

  1. Payback via Idling: If the instance's CPU utilization subsequently drops below the baseline, the credits it earns are first used to pay down the surplus credit debt rather than adding to the positive accrued balance.
  2. Billed Surplus Credits: If the surplus credit balance reaches the maximum 24-hour cap, or if there is an outstanding surplus balance when the hourly billing cycle reconciles, AWS bills the account a flat rate per vCPU-hour (equivalent to \(60\text{ credits}\)) for the excess usage.

This allows workloads in Unlimited mode to handle unexpected, prolonged traffic spikes without experiencing performance degradation, while keeping costs low during normal operating periods when average CPU utilization stays at or below the baseline.