EC2 and choosing an instance type

Choosing an EC2 instance by the resource that runs out first, telling an AMI apart from user data and a snapshot, and the reason data on an instance store disappears when the instance is stopped.

Lesson 3 of 11 in objective 3. Cloud technology and services, part of AWS Certified Cloud Practitioner (CLF-C02).

Two kinds of disk on one instance, and only one of them survives a stop. Instance store — Where it physically is: On the host the instance is running on; Survives a reboot: Yes — same host; Survives a stop: No — the host is released and the data goes with it; Right for: Scratch space, caches, data held somewhere else too. Amazon EBS — Where it physically is: On the network, attached to the instance; Survives a reboot: Yes; Survives a stop: Yes, and it can be detached, reattached and snapshotted; Right for: Boot volumes, databases, anything you would miss Instance store Amazon EBS Where it physically is On the host the instance is running on On the network, attached to the instance Survives a reboot Yes — same host Yes Survives a stop No — the host is released and the data goes with it Yes, and it can be detached, reattached and snapshotted Right for Scratch space, caches, data held somewhere else too Boot volumes, databases, anything you would miss
Two kinds of disk on one instance, and only one of them survives a stop.

Pick the family by the bottleneck, the size afterwards

Instance families exist because workloads run out of different things. General purpose is balanced and is the sensible default. Compute optimized gives a high ratio of vCPU to memory for processor-bound work. Memory optimized gives the most memory per instance, for large in-memory datasets, caches and big relational databases. Storage optimized exists for very high local disk throughput and IOPS. Accelerated computing adds GPUs or purpose-built chips for massively parallel maths.

The exam asks this by describing a resource profile and offering four families, so read the stem for what runs out first. A 400 GB dataset loaded entirely into memory hits the memory ceiling however many vCPUs an option promises; a job that saturates processors while touching almost no data is the mirror image. Getting the FAMILY right matters more than getting the size right, because the size is a decision you can revisit and the family is the one that makes an instance the wrong shape.

The disk that disappears

An instance store is physically attached to the host your instance happens to be running on. That is what makes it the fastest storage available and what makes it ephemeral: stopping or terminating the instance releases the host, and the data goes with it. A REBOOT keeps the same host and therefore keeps the data, which is precisely why this failure mode can hide for months — everything survives every restart until the first stop.

Amazon EBS is network-attached instead. The volume exists independently of the instance, follows it through a stop and start, can be detached and attached elsewhere in the same Availability Zone, and can be snapshotted. The rule that follows is short: instance store for anything you could lose without caring, EBS for anything else. Encryption is not part of this story at all — it decides who can read the data, never whether the data persists.

Baking an image beats running a script

An Amazon Machine Image captures the operating system, its configuration and the software installed on it, so an instance launched from it starts in a known state in the time it takes to boot. That is the answer whenever a stem complains both that provisioning is slow and that no two servers end up quite alike, because it fixes both halves at once: the forty-minute script is spent once, at bake time, rather than at every launch where a slow package mirror can make one server subtly different again.

User data is the neighbour that looks like the same thing and is not. It automates the work but still performs it on every launch, so it belongs to the short, environment-specific tail rather than the bulk. An EBS snapshot is a different object again: it copies a volume's data, and an AMI references snapshots but also carries the metadata AWS needs in order to LAUNCH something. "Attach the snapshot to each new instance" is the option written to catch a candidate who has merged the two.

Three things that all copy part of an instance, and are not interchangeable. AMI — What it holds: A launchable image: operating system, configuration, software; When it acts: At launch, in the time it takes to boot; What it is for: Every new instance starting identical to its siblings. User data — What it holds: A script the instance runs on itself; When it acts: At first boot, at every launch; What it is for: The last-mile settings that differ per environment. EBS snapshot — What it holds: A point-in-time copy of one volume; When it acts: When you take it, and when you restore it; What it is for: Backup, moving a volume between zones, building an AMI AMI User data EBS snapshot What it holds A launchable image: operating system, configuration, software A script the instance runs on itself A point-in-time copy of one volume When it acts At launch, in the time it takes to boot At first boot, at every launch When you take it, and when you restore it What it is for Every new instance starting identical to its siblings The last-mile settings that differ per environment Backup, moving a volume between zones, building an AMI
Three things that all copy part of an instance, and are not interchangeable.

Rightsizing is a decision you get to change

Two properties of EC2 make sizing an ongoing activity rather than a bet placed on day one. Burstable general purpose instances — the T family — accumulate credits while they are idle and spend them during short bursts, which prices an idle-with-spikes workload such as a small internal wiki honestly instead of charging for a peak that lasts ten minutes a day. And an EBS-backed instance can be moved to a different instance type by stopping it and starting it again, so an instance chosen badly is corrected rather than lived with.

Price scales with size, roughly in proportion, which is why oversizing is the most common avoidable EC2 cost there is. Amazon CloudWatch metrics show what an instance actually used and AWS Compute Optimizer turns that history into a recommendation. The belief the exam probes is the opposite one — that the type is fixed for the life of the instance and must therefore be chosen for the worst case now — and it is wrong.

Worth carrying in

General purpose
Balanced vCPU and memory. The default, and the home of the burstable T family.
Compute optimized
High vCPU per unit of memory, for processor-bound work.
Memory optimized
Most memory per instance. Large in-memory datasets, caches, big relational databases.
Storage optimized
Very high local disk throughput and IOPS.
Accelerated computing
GPUs and purpose-built chips, for training, inference and rendering.
AMI
A launchable image. Bake once, launch many, every instance identical.
User data
A script run at first boot. Keep it short; it runs at every launch.
Instance store
Local disk on the host. Fastest, included in the price, gone at stop or terminate.
Amazon EBS
Network-attached block storage. Persists independently of the instance and can be snapshotted.
AWS Compute Optimizer
Turns observed usage into a rightsizing recommendation.

What the exam does with this

Objective
3. Cloud technology and services
Share of the exam
34% (the whole objective)
Questions in this lesson
4
Signed for by a person
0

Partly checked. None of the 4 questions here has been read against the cited source by a person. 4 questions have been checked against their cited clause by an automated pass — which is not the same thing, and is not a signature.

Only questions a person has signed for are used in mock exams here. That is the whole difference between the two kinds of checking above.

Questions in this lesson

Drill this lesson

A lesson is one sitting: the trainer draws a short run from these questions alone and spaces the ones you get wrong.

Practise EC2 and choosing an instance type

The rest of objective 3