Compute: Amazon EC2
Virtual servers in the cloud — instance types, pricing options, and the EC2 vocabulary every other service builds on.
Amazon EC2 (Elastic Compute Cloud) provides resizable virtual servers called instances. It's the classic IaaS service: you pick the OS (via an AMI — Amazon Machine Image), the hardware profile (instance type), and you manage everything from the OS up.
Instance type families
| Family | Optimized for | Example workload |
|---|---|---|
| General purpose (t3, m7) | Balanced CPU/memory | Web servers, small databases |
| Compute optimized (c7) | High CPU | Batch processing, gaming servers, encoding |
| Memory optimized (r7, x2) | Large RAM | In-memory caches, big databases, real-time analytics |
| Storage optimized (i4, d3) | Fast local disk I/O | Data warehousing, high-frequency databases |
| Accelerated computing (p5, g6) | GPUs / accelerators | Machine learning training, graphics |
EC2 pricing options
| Option | Discount | Best for | Catch |
|---|---|---|---|
| On-Demand | None (baseline) | Unpredictable, short-term, spiky workloads | Most expensive per hour |
| Reserved Instances (1 or 3 yr) | Up to ~72% | Steady-state workloads (e.g., a database that runs 24/7) | Commitment to instance family/Region |
| Savings Plans (1 or 3 yr) | Up to ~72% | Steady spend with flexibility across instance types (and Fargate/Lambda) | Commit to $/hour, not instances |
| Spot Instances | Up to ~90% | Fault-tolerant, interruptible jobs: batch, CI, big data | AWS can reclaim with a 2-minute warning |
| Dedicated Hosts | Premium price | Compliance/licensing that requires a physical server to yourself | Most expensive option |
Pricing scenarios are guaranteed on the exam: 24/7 steady workload → Reserved/Savings Plans; can be interrupted → Spot; unpredictable/short-term → On-Demand; server-bound software licenses or strict tenancy rules → Dedicated Hosts.
Essentials that orbit EC2
Key points
- AMI — the template (OS + software) an instance launches from; you can create your own for repeatable builds.
- Security group — instance-level virtual firewall; stateful; allows rules only.
- Key pair — SSH credentials for connecting to Linux instances.
- EC2 Instance Connect / Session Manager — browser-based access without managing SSH keys (Session Manager needs no open ports).
- Tenancy — shared (default), dedicated instance, or dedicated host.
Choosing EC2 options is like renting vehicles: On-Demand is a taxi (pay per trip), Reserved is a 3-year lease (cheaper monthly), Spot is a standby airline ticket (huge discount, might get bumped), and a Dedicated Host is buying out the whole limo — nobody else rides.
A nightly batch job can tolerate interruptions and restarts. Which EC2 purchasing option minimizes its cost?