SysPad › Lessons › compute lessons › EC2 Instance
How EC2 Instance works
Virtual server in the cloud. Choose instance type to balance compute, memory, and network. Latency and throughput scale linearly with vCPU up to ~70% utilisation, then degrade.
EC2 is the rawest piece of AWS compute: a virtual machine you rent by the second. Total control, and total responsibility, you own everything from the operating system up. Most of EC2’s art is two questions: which slice of a physical server do you need, and do you grow it taller or wider?
What you will learn
- What actually IS an EC2 instance, and where do its CPU/memory come from?
- Why does picking an instance family matter more than picking a size?
- Scaling up vs scaling out: when does each make sense?
- On-Demand, Reserved/Savings Plans, or Spot, what are you really choosing?
A slice of a real server
An EC2 instance is a virtual machine: a hypervisor divides a physical host into isolated VMs, and you rent one. It boots from an AMI (Amazon Machine Image), a snapshot of an OS and software.
That means you’re responsible for the OS, patches, and your software, AWS handles the hardware, hypervisor, and facilities. Maximum flexibility, maximum upkeep.
Families and sizes
Instances come in families tuned for a job: general purpose (m), compute optimized (c), memory optimized (r/x), GPU/accelerated (p/g), and more. Within a family,sizes (large, xlarge, …) scale CPU/memory roughly linearly.
⚓ c-family for compute-heavy APIs and batch math; r/x for big in-memory datasets; g/p for ML and rendering.
Scale up or scale out
Vertical scaling (scale up) means a bigger instance: easy, but capped by the largest size and usually needs a restart. Horizontal scaling (scale out) means more instances behind a load balancer, with an Auto Scaling group adding and removing them as demand changes.
Paying for it: On-Demand, Reserved, Spot
On-Demand: pay per second, no commitment, max flexibility, highest rate. Reserved Instances / Savings Plans: commit to 1 or 3 years for a big discount on steady usage. Spot: bid on spare capacity for up to ~90% off, but AWS can reclaim it with a short warning.
Flashcards
- What is an EC2 instance, physically?
- A virtual machine: a hypervisor-isolated slice of a physical AWS host, booted from an AMI. You own the OS and up; AWS owns the hardware.
- Why choose the instance family before the size?
- The family matches your bottleneck (compute / memory / GPU). The wrong family wastes money; size just scales how much of that shape you get.
- Vertical vs horizontal scaling in one line each?
- Vertical = a bigger instance (simple, capped, single point of failure). Horizontal = more instances behind a load balancer via an Auto Scaling group (elastic, fault-tolerant, needs stateless).
- When is Spot the right pricing model, and when is it dangerous?
- Right for interruptible, fault-tolerant work (up to ~90% off); dangerous for anything that can’t survive AWS reclaiming the instance on short notice.
- Compared to Lambda or Fargate, what extra work does EC2 put on you?
- Managing the OS, patching, scaling config, and capacity. EC2 trades that upkeep for maximum control.
Sources
- AWS, What is Amazon EC2
- AWS, Instance types and families
- AWS, Auto Scaling groups
- AWS, Instance purchasing options (On-Demand, Savings Plans, Spot)
Open the SysPad canvas · Official EC2 Instance documentation