Amazon Elastic Compute Cloud
User Guide for Linux (API Version 2014-10-01)
Did this page help you?  Yes | No |  Tell us about it...
« PreviousNext »
View the PDF for this guide.Go to the AWS Discussion Forum for this product.Go to the Kindle Store to download this guide in Kindle format.

T2 Instances

T2 instances are designed to provide moderate baseline performance and the capability to burst to significantly higher performance as required by your workload. They are intended for workloads that don't use the full CPU often or consistently, but occasionally need to burst. T2 instances are well suited for general purpose workloads, such as web servers, developer environments, and small databases. For more information about T2 instance pricing and additional hardware details, see Instance Type Details.

T2 instances are currently available in three instance sizes: t2.micro, t2.small, and t2.medium. Customers can launch T2 instances using the AWS management console, Amazon EC2 command line interface, and the AWS SDKs. T2 instances are available as On-Demand or Reserved Instances, but they cannot be purchased as Spot Instances. For more information, see Amazon EC2 Instance Purchasing Options. T2 instance types are available as Amazon EBS-backed instances only.

Hardware Specifications

For more information about the hardware specifications for each Amazon EC2 instance type, see Instance Type Details.

CPU Credits

A CPU Credit provides the performance of a full CPU core for one minute. Traditional Amazon EC2 instance types provide fixed performance, while T2 instances provide a baseline level of CPU performance with the ability to burst above that baseline level. The baseline performance and ability to burst are governed by CPU credits.

What is a CPU credit?

One CPU credit is equal to one vCPU running at 100% utilization for one minute. Other combinations of vCPUs, utilization, and time are also equal one CPU credit, such as one vCPU running at 50% utilization for two minutes, or two vCPUs (on t2.medium instances, for example) running at 25% utilization for two minutes.

How are CPU credits earned?

Each T2 instance starts with a healthy initial CPU credit balance and then continuously (at a millisecond-level resolution) receives a set rate of CPU credits per hour, depending on instance size. The accounting process for whether credits are accumulated or spent also happens at a millisecond-level resolution, so you don't have to worry about overspending CPU credits; a short burst of CPU takes a small fraction of a CPU credit.

When a T2 instance uses fewer CPU resources than its base performance level allows (such as when it is idle), the unused CPU credits (or the difference between what was earned and what was spent) are stored in the credit balance for up to 24 hours, building CPU credits for bursting. When your T2 instance requires more CPU resources than its base performance level allows, it uses credits from the CPU credit balance to burst up to 100% utilization. The more credits your T2 instance has for CPU resources, the more time it can burst beyond its base performance level and the better it will perform when more performance is needed.

The following table lists the initial CPU credit allocation received at launch, the rate at which CPU credits are received, the baseline performance level as a percentage of a full core performance, and the maximum CPU credit balance that an instance can accrue.

Instance type

Initial CPU credit*

CPU credits earned per hour

Base performance (CPU utilization)

Maximum CPU credit balance

t2.micro

30

6

10%

144

t2.small

30

12

20%

288

t2.medium

60

24

40%**

576

* There are limits to how many of your T2 instances will launch or start with the initial credit, which by default is set to 100 launches or starts per 24-hour period by region. If you'd like to increase this limit, you can file a customer support limit increase request by using the Amazon EC2 Instance Request Form.

** t2.medium instances have two vCPUs. The base performance is an aggregate of the two vCPUs; this can be 40% utilization on one vCPU, 20% each on two vCPUs, or any combination that does not exceed 40%.

The t2.micro and t2.small instance types launch with an initial balance of 30 CPU credits, and the t2.medium instance type launches with 60 CPU credits. This initial credit balance is designed to provide a good startup experience. The maximum credit balance for an instance is equal to the number of CPU credits received per hour times 24 hours. For example, a t2.micro instance earns 6 CPU credits per hour and can accumulate a maximum CPU credit balance of 144 CPU credits.

Do CPU credits expire?

Yes. Unused credits (including the initial credit earned at launch time) expire 24 hours after they are earned, and any expired credits are removed from the CPU credit balance at that time. Additionally, the CPU credit balance for an instance does not persist between instance stops and starts; stopping an instance causes it to lose its credit balance entirely, but when it restarts it will receive its initial credit balance again.

For example, if a t2.small instance had a CPU utilization of 5% for the hour, it would have used 3 CPU credits (5% of 60 minutes), but it would have earned 12 CPU credits during the hour, so the difference of 9 CPU credits would be added to the CPU credit balance. Any CPU credits in the balance that reached their 24 hour expiration date during that time (which could be as many as 12 credits if the instance was completely idle 24 hours ago) would also be removed from the balance. If the amount of credits expired is greater than those earned, the credit balance will go down; conversely, if the amount of credits expired is fewer than those earned, the credit balance will go up.

What happens if I use all of my credits?

If your instance uses all of its CPU credit balance, performance remains at the baseline performance level. If your instance is running low on credits, your instance’s CPU credit consumption (and therefore CPU performance) is gradually lowered to the base performance level over a 15-minute interval, so you will not experience a sharp performance drop-off when your CPU credits are depleted. If your instance consistently uses all of its CPU credit balance, we recommend a larger T2 size or a fixed performance instance type such as M3 or C3.

EC2-VPC-only Support

T2 instances must be launched into an Amazon Virtual Private Cloud (VPC); they are not supported on the EC2-Classic platform. Amazon VPC enables you to launch AWS resources into a virtual network that you've defined. You cannot change the instance type of an existing EC2-Classic instance to a T2 instance type. For more information on EC2-Classic and EC2-VPC, see Supported Platforms.

If your account supports EC2-Classic and you have not created any VPCs, you can do one of the following to launch a T2 instance:

  • Create a VPC, and launch your instance into it. For more information, see Getting Started with Amazon VPC in the Amazon VPC Getting Started Guide.

  • Launch a T2 instance using the launch wizard in the Amazon EC2 console. The wizard creates a nondefault VPC in your account with the following attributes:

    • A subnet in each Availability Zone. By default, the wizard selects the subnet in the first Availability Zone in which to launch your instance. The public IP addressing attribute of each subnet is set to true so that instances launched into each subnet receive a public IP address. For more information, see Modifying Your Subnet's Public IP Addressing Behavior in the Amazon VPC User Guide.

    • An Internet gateway, and a main route table that routes the VPC's traffic to the Internet gateway. This enables your VPC (and instances in your subnet) to communicate over the Internet. For more information about Internet gateways, see Adding an Internet Gateway to Your VPC.

    • A default network ACL associated with all subnets, and a default security group. For more information about network ACLs, see Network ACLs. For more information about security groups, see Security Groups for Your VPC.

If you are using the Amazon EC2 API, the Amazon EC2 CLI, or the AWS CLI, you must have a default VPC in which to launch your T2 instance, or you must specify a subnet ID or network interface ID in the request.

By launching an instance into a VPC, you can leverage a number of features that are available only on the EC2-VPC platform; such as assigning multiple private IP addresses to your instances, or changing your instances' security groups. For more information about the benefits of using a VPC, see Amazon EC2 and Amazon Virtual Private Cloud (VPC). You can take steps to migrate your resources from EC2-Classic to EC2-VPC. For more information, see Migrating from EC2-Classic to a VPC.

HVM AMI Support

T2 instances require HVM AMIs.

Default T2 Instance Limits

We limit the number of each T2 instance type that you can run simultaneously to 20. If you need more than 20 T2 instances, you can request more by using the Amazon EC2 Instance Request Form.

Monitoring Your CPU Credits

You can see the credit balance for each T2 instance presented in the Amazon EC2 per-instance metrics of the CloudWatch console. T2 instances have two metrics, CPUCreditUsage and CPUCreditBalance. The CPUCreditUsage metric indicates the number of CPU credits used during the measurement period. The CPUCreditBalance metric indicates the number of unused CPU credits a T2 instance has earned. This balance is depleted during burst time as CPU credits are spent more quickly than they are earned.

The following table describes the new available CloudWatch metrics; for more information on using these metrics in CloudWatch, see View Amazon EC2 Metrics.

MetricDescription

CPUCreditUsage

(Only valid for T2 instances) The number of CPU credits consumed during the specified period.

This metric identifies the amount of time during which physical CPUs were used for processing instructions by virtual CPUs allocated to the instance.

Note

CPU Credit metrics are available at a 5 minute frequency.

Units: Count

CPUCreditBalance

(Only valid for T2 instances) The number of CPU credits that an instance has accumulated.

This metric is used to determine how long an instance can burst beyond its baseline performance level at a given rate.

Note

CPU Credit metrics are available at a 5 minute frequency.

Units: Count