Learn EC2 instance types, pricing models, security groups, and when to use each. This is the most heavily tested EC2 topic in SAA-C03.
EC2 — Elastic Compute Cloud
EC2 gives you virtual servers (called instances) in the cloud. You choose the size, operating system, and configuration. AWS manages the physical hardware.
Teacher Note: Think of EC2 like renting a laptop from AWS. You choose: small laptop (t3.micro) or powerful workstation (m5.4xlarge). You install your own software. You can start it, stop it, or upgrade it anytime.
Instance Families — Choosing the Right Size
| Family | Optimised For | Example Use Case | Examples |
|---|
| T | Burstable — general purpose, variable load | Dev servers, small websites | t3.micro, t3.medium |
| M | Balanced CPU and Memory | Web servers, app servers | m6i.large, m7g.xlarge |
| C | Compute — high CPU | Video encoding, batch processing, gaming | c6i.xlarge, c7g.2xlarge |
| R | Memory — lots of RAM | Databases, caches, in-memory analytics | r6i.xlarge, r7g.2xlarge |
| I | Storage — fast NVMe SSDs | High-performance databases, Kafka | i3.xlarge, i4i.2xlarge |
| P/G | GPU — graphics processing | Machine learning training, rendering | p3.2xlarge, g5.xlarge |
Pricing Models — Pay Less, Smartly
| Model | Discount | Best For | Commitment |
|---|
| On-Demand | 0% (baseline) | Short-term, unpredictable workloads | None |
| Reserved Instances | 40-60% | Steady 24/7 workloads (databases, app servers) | 1 or 3 years |
| Savings Plans | 40-60% | Flexible — works across instance families | 1 or 3 years |
| Spot Instances | 70-90% | Fault-tolerant batch jobs, rendering, ML training | None — can be interrupted |
| Dedicated Hosts | Varies | Compliance, BYOL (Oracle, Windows licenses) | On-demand or reserved |
EC2 Key Concepts for the Exam
- Security Groups: virtual firewall — stateful, allow-only rules, applies at instance level
- User Data: shell script that runs ONCE on first boot — for bootstrapping/configuration
- AMI (Amazon Machine Image): snapshot of an OS + installed software — used to launch instances
- Elastic IP: static public IP address that you own — survives instance stops
- Instance Store: fast temporary storage physically attached — DATA LOST when instance stops
Exam Tip: Spot Instances = up to 90% cheaper BUT can be interrupted with 2-minute warning. NEVER use Spot for production databases. USE Spot for: batch jobs, Hadoop, rendering, and stateless web servers that can restart safely.