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).
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.
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
- An instance store survives a REBOOT and not a STOP. The word the stem uses decides the answer, and encryption is never the explanation for missing data.
- An AMI is what you LAUNCH; a snapshot is a copy of a volume. An option that attaches a snapshot to a new instance is testing whether you have merged the two.
- Family first, size second, and the family follows the resource that runs out. A large in-memory working set is memory optimized no matter how many vCPUs a cheaper option offers.
- An EBS-backed instance changes type with a stop and a start, so "we must size for the worst case now" is always the wrong statement in a choose-two question.
- 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
- A genomics team runs an analysis that loads a 400 GB reference dataset entirely into memory and then makes many small passes over it. Processor usage stays moderate throughout and there is very little disk activity once the data is loaded. Which EC2 instance family should they start from? machine-checked
- Every new web server in a fleet needs the same operating system hardening, monitoring agent and application runtime. Today an engineer launches a plain Amazon Linux instance and runs a 40-minute setup script by hand, and no two servers end up quite alike. They want a new server ready in about a minute, identical to its siblings. What should they do? machine-checked
- An application writes uploaded customer files to a local NVMe instance store volume on its EC2 instance, alongside its temporary scratch data. The instance was stopped for a maintenance change and started again an hour later. The uploaded files are gone; the operating system and the application, which live on the root EBS volume, are intact. What explains this? machine-checked
- A team is sizing an EC2 instance for a small internal wiki. It is idle for most of the working day and gets short bursts of use when someone searches it. Which TWO statements should guide the decision? machine-checked
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
- Ways in: console, CLI, SDKs and infrastructure as code
- Regions, Availability Zones and edge locations
- EC2 and choosing an instance type — you are here
- Containers, serverless, auto scaling and load balancing
- Relational, NoSQL and in-memory databases, and moving them
- VPCs, subnets, traffic controls and private connectivity
- Object storage and the S3 storage classes
- Block, file and hybrid storage, lifecycle rules and backup
- Machine learning and analytics services
- Messaging, integration and business applications
- Developer tools, end-user computing, front end and IoT