AWS labs · Lesson 5 · EC2
AWS sells over 1,300 kinds of virtual machine in over 160 families. That sounds like a lot to memorise, but you don't need to. Every name follows one pattern, every family is a fixed mix of CPU and memory, and every size doubles the one before it. Learn those three things, plus a few prices, and you can size a machine as soon as you hear someone describe their problem.
m8g.xlarge = family m, generation 8, chip g (Graviton), size xlarge.g) is the cheapest chip, Spot is 50 to 90% off but can be taken away, and a 1 or 3 year commitment saves roughly 25 to 50%.Somewhere in a data centre there is a physical box with two processors, a few hundred gigabytes of memory, some fast disks and a network card. AWS cuts that box into slices and rents you one. The name of your instance tells you how big the slice is.
Try it. Drag to turn the server (open it on its own to zoom). Move the size and watch how much of the host lights up. Switch C, M and R: the processors stay the same, only the memory changes. That is the real difference between those families (c7i, m7i and r7i all run on the same Intel chips), and it's why R costs more than C for the same vCPUs. The stick counts are a teaching model: AWS doesn't publish how its hosts are filled, but the totals (384, 768 and 1,536 GiB for the whole host) are the real .metal sizes.
d also come with local NVMe disks, which are fast but wiped when the instance stops.A host is cut in halves, then halves of halves. A 48xlarge is the whole host, a 24xlarge is half, a 12xlarge a quarter, and so on down to large, which is 1/96 of it. Because the slices are fair shares, the price per vCPU is the same at every size. Two large cost exactly what one xlarge costs.
.metal meansThe whole server with no hypervisor. It costs the same as the biggest virtual size. People use it to run their own hypervisor, for software licensed per physical core, or to read low-level hardware counters.
Every name has the same four parts. Type one in, or click an example.
| Letter | Means | Example |
|---|---|---|
g | AWS Graviton (ARM) processor, the cheapest | m8g |
a | AMD processor | m8a |
i | Intel processor | m8i |
d | Local NVMe disks included | m8gd |
n | Extra network bandwidth | c8gn |
b | Extra EBS (block storage) bandwidth | r8gb |
e | Extra of something: memory, disk or network | x2iedn, i8ge |
z | High clock speed | r7iz |
-flex | Cheaper, full speed most of the time but not guaranteed | m7i-flex |
-24tb, -b200 | Memory size or GPU model, spelled out | u7in-24tb, p6-b200 |
| Size | vCPU (most families) |
|---|---|
nano · micro · small | 2 (T family only, less memory) |
medium | 1 (Graviton, AMD) or 2 (T) |
large | 2 |
xlarge | 4 |
2xlarge | 8 |
4xlarge | 16 |
Nxlarge | 4 × N |
metal | the whole server |
Rule: vCPU = 4 × the number before "xlarge". A 12xlarge has 48 vCPU, a 48xlarge has 192.
m4 and c4 are still on sale but cost more than new ones for less speed. When in doubt, pick the newest generation that your software supports.AWS groups families into five categories. Inside each card: the letter, a way to remember it, its memory per vCPU, what people use it for, and the price of a typical size in the newest generation.
Each dot is one instance type, placed by its vCPUs (across) and memory (up). Both axes double at each gridline. The dashed lines are the ratios: every dot on the "8 GiB per vCPU" line is an R-shaped machine, whatever its name.
Pick a category to colour it. Hover a dot for its name and price. Notice how general, compute and memory families sit on three parallel lines, while storage and accelerated instances scatter: their value is the disk or the GPU, which this chart doesn't show.
Pick a family and look at the last column. The price per vCPU stays flat while everything else doubles. That's why "start small and resize" is safe: resizing costs exactly in proportion.
| Instance | vCPU | Memory | $/hour | $/month | Price | $/vCPU·month |
|---|
Most families come in three processor flavours. Here is the same shape (2 vCPU, 8 GiB, family M) on each chip, newest generations first.
| Instance | Processor | Physical cores | $/month | vs cheapest |
|---|
arm64.i) for specific instruction sets like AVX-512 and AMX, or AMD (a) when you want a full core per vCPU on x86.The T family is the only one where the CPU is shared. You get a small guaranteed baseline, and you bank CPU credits whenever you use less than that. Above the baseline you spend them. When they run out, the machine is either slowed down to the baseline or (in "unlimited" mode, the default) it keeps going and you pay extra.
Try it. The slider sets how busy the CPU is; move the pointer across the tank to scrub through a day, one dot per hour. The spout always pours in 12 credits an hour, and the tap pours out whatever the CPU spends. Below 10% use the tank fills; above it, it drains, and once empty the CPU is held to the baseline. The figure starts half full and shows standard mode (see unlimited mode below).
t3.microThe average load is low and the peaks are short: a personal site, a dev box, a bastion host, a small internal tool. Don't use T for anything busy all day, like a build server or a steady API. There an M or C costs about the same and never slows down. If a T instance is always out of credits, move it to m or c.
For AI work the question is rarely "how many vCPUs". It's "how much accelerator memory": the model has to fit in it. Rule of thumb for running a model at 16-bit precision: about 2 GB per billion parameters, plus room for the conversation (the KV cache). Squeezing it to 4-bit needs about a quarter of that.
| Instance | Accelerator | Count | Accel. memory | Fits at 16-bit | $/hour | $/month | Typical use |
|---|
G = graphics and inference. One to eight mid-range GPUs (T4, A10G, L4, L40S, RTX PRO). Use them to serve models, render video and graphics, or run remote workstations.
P = premium training. Eight top data-centre GPUs (A100, H100, H200, B200, B300) joined by very fast links. Use them to train or fine-tune large models. This is the most expensive hardware AWS rents.
Inf (Inferentia) serves models and Trn (Trainium) trains them, usually for a lower price than comparable NVIDIA GPUs. The catch: you use the AWS Neuron SDK instead of CUDA, so not every model works on day one. F has FPGAs and VT has video-transcoding chips. Both are niche.
You don't need every price. You need a few anchors, so that "$50 a month" or "$40,000 a month" lands somewhere in your head. The scale is logarithmic: each gridline is ten times the one before.
The same machine has four prices, depending on how much you promise and how much risk you accept.
New AWS users are often surprised by these. Fill in a setup and see the monthly total.
Rates for us-east-1: gp3 $0.08 per GB-month, public IPv4 $0.005 per hour while it's assigned (about $3.65 a month), data out $0.09 per GB after the first 100 GB a month, which are free across your account. A stopped instance costs nothing for compute, but its EBS disk keeps billing, and so does an Elastic IP left attached to it.
This is the skill the whole page builds towards. When someone describes their workload, listen for the clue words: they tell you the family. The numbers they give tell you the size.
| When you hear… | Think | Because |
|---|---|---|
| "small site", "dev box", "mostly idle", "a few users" | t4g / t3 | Low average CPU; credits cover the peaks |
| "web app", "API", "Kubernetes nodes", "a bit of everything" | m | Balanced; the safe default |
| "CPU-bound", "encoding", "batch", "CI builds", "high traffic web" | c | Most CPU per dollar, little memory |
| "database", "cache", "Redis", "analytics", "JVM with a big heap" | r | Memory is the bottleneck |
| "in-memory database", "SAP", "terabytes of RAM" | x / u | 16 GiB+ per vCPU, up to 32 TB in one box |
| "lots of IOPS", "Cassandra", "Kafka", "Elasticsearch", "low-latency disk" | i | Local NVMe, millions of IOPS |
| "hundreds of terabytes", "Hadoop", "cheap bulk disk" | d | Local hard drives, cheapest per TB on a machine |
| "serve a model", "inference", "video rendering", "remote desktop" | g / inf | Mid-range GPUs or Inferentia |
| "train", "fine-tune", "multi-GPU", "H100" | p / trn | Top GPUs with fast interconnect |
| "per-core licence", "single-thread speed", "EDA", "game server" | z1d, r7iz, m8azn | Highest clock speeds |
| "network appliance", "firewall", "100 Gbps" | c8gn and other …n | Extra network bandwidth |
| "MPI", "weather or CFD simulation", "tightly coupled" | hpc7g | Low-latency EFA networking, priced for HPC |
| "build iOS apps", "Xcode" | mac | Real Macs on dedicated hosts, 24-hour minimum |
| "can be interrupted", "restartable", "queue of jobs" | Spot | Same machine, 50 to 90% off |
Type the needs you heard. It searches every instance in the chosen region and lists the cheapest that fit.
| Instance | Category | vCPU | Memory | Extra | $/month | Spot $/month |
|---|
The full list for the chosen region. Click a column to sort. Search accepts a family (r8g), a chip (graviton4) or a GPU (h100).
| Instance | Category | vCPU | GiB | GiB/vCPU | Accel. | Local disk | Network | $/hour | $/month | Spot $/h | Processor |
|---|
The table shows 150 rows until you ask for all of them.
Ten situations. Pick the best answer; the reason appears after you choose.
m8g.xlarge: the shape and size of the machine.gp3 is the everyday type.d, and i). Very fast, but the data is lost when the instance stops or the host fails.nproc and free -g on the instance and compare them with what this page says.aws ec2 describe-instance-types --instance-types m8g.large and match each field to this page.tools/build_data.py