Sub topic 4
Instance types and families
This chapter assumes you know what an AMI is, understand Regions and Availability Zones, and can read basic CLI output. It explains how to read an instance type name and how to pick a type for a workload.
Reading an instance type name
An instance type is a fixed bundle of vCPUs, memory, network bandwidth, and storage options. The name encodes what the bundle is. Take m7g.xlarge:
mis the family, a group of types built for a similar workload.7is the generation. Higher numbers are newer, and they usually give better price and performance.gis an attribute. Here it means AWS Graviton (Arm) processors. Other common letters areifor Intel,afor AMD,dfor local NVMe instance store, andnfor enhanced networking.xlargeis the size. Sizes run fromnanoandmicroup throughlarge,xlarge,2xlarge, and beyond. Within one family, each step up roughly doubles vCPUs and memory.
Main families
| Family | Optimized for | Typical use |
|---|---|---|
| T (for example `t3`) | Burstable general purpose | Small web servers, dev and test |
| M | Balanced CPU and memory | Application servers, small databases |
| C | Compute | Batch processing, encoding, game servers |
| R, X | Memory | In-memory caches, large databases, analytics |
| I, D | Storage (local disks) | High-IOPS databases, data warehouses |
| P, G | Accelerated (GPU) | Machine learning, graphics |
Burstable instances
The t types earn CPU credits while idle and spend them when busy. This is why t3.micro works well for a lightly used web server. If the workload uses more CPU than its baseline for long periods, the credits run out. In the default standard mode, the CPU is then throttled to the baseline. In unlimited mode, the instance keeps running at full speed and you pay a surcharge. For steady high CPU use, an m or c type is the better and often cheaper choice.
Architecture must match the AMI
Graviton types such as m7g run arm64. Intel and AMD types run x86_64. An AMI is built for one architecture, so it only launches on matching types. The AMI parameter in the launch example uses x86_64, so it works with t3.micro but not with a Graviton type. A mismatch gives an error when you call run-instances.
Checking what a type offers
Use the CLI to compare types before you launch. This command lists the vCPU and memory for two sizes. It also shows whether each type is available in your current Region.
aws ec2 describe-instance-types \
--instance-types t3.micro m7g.xlarge \
--query 'InstanceTypes[].[InstanceType,VCpuInfo.DefaultVCpus,MemoryInfo.SizeInMiB,ProcessorInfo.SupportedArchitectures[0]]' \
--output tableTo see which types a Region offers, run aws ec2 describe-instance-type-offerings --location-type region. Availability varies by Region and sometimes by Availability Zone.
Choosing a type
- Identify the limiting resource: CPU, memory, storage speed, or a GPU.
- Pick the family that targets it. When unsure, start with
m. - Start with a smaller size and measure with CloudWatch.
- Resize if needed. You can change the type of a stopped EBS-backed instance with
aws ec2 modify-instance-attribute.
Exercise
A workload needs 64 GiB of RAM but little CPU, and your AMI is built for x86_64. Which family would you try first, and what must you check about the type before launching?
Show answer
Try a memory-optimized family such as R. Check that the type uses an x86_64 processor (for example r6i, not a Graviton r6g) so it matches the AMI, and that the type is offered in your Region.