3.1 EC2 Instance Types, Purchasing Options, and Placement Groups
Key Takeaways
- EC2 instance families are categorized by purpose: General Purpose (M/T), Compute Optimized (C), Memory Optimized (R/X), Storage Optimized (I/D/H), and Accelerated Computing (P/G/F).
- On-Demand provides maximum flexibility; Reserved Instances (1-3 year) save up to 72%; Savings Plans save up to 72% with more flexibility; Spot Instances save up to 90% but can be interrupted.
- Placement groups control instance placement: Cluster (low latency in same AZ), Spread (max 7 per AZ, high availability), Partition (large distributed systems like HDFS/Cassandra).
- For the exam, match the workload to the correct instance family: compute-intensive → C-series, memory-intensive → R-series, storage-intensive → I/D-series.
- Spot Instances are ideal for fault-tolerant, flexible workloads like batch processing, data analysis, and CI/CD — NOT for databases or stateful applications.
EC2 Instance Types, Purchasing Options, and Placement Groups
Quick Answer: Match workloads to instance families: General (M/T), Compute (C), Memory (R/X), Storage (I/D), Accelerated (P/G). Use On-Demand for flexibility, Reserved/Savings Plans for steady-state (up to 72% off), and Spot for fault-tolerant workloads (up to 90% off). Placement groups control physical placement for performance or availability.
EC2 Instance Families
Instance Naming Convention
Example: m5.xlarge
- m = family (General Purpose)
- 5 = generation
- xlarge = size (vCPUs and memory)
Instance Families
| Family | Purpose | Examples | Use Cases |
|---|---|---|---|
| T (Burstable) | General purpose, burstable | t3.micro, t3.medium | Dev/test, small websites, microservices |
| M (General) | General purpose, balanced | m7i.large, m6g.xlarge | Web servers, app servers, small databases |
| C (Compute) | Compute optimized | c7g.xlarge, c6i.2xlarge | Batch processing, ML inference, gaming, HPC |
| R (Memory) | Memory optimized | r7g.2xlarge, r6i.4xlarge | In-memory databases, real-time analytics, SAP |
| X (Extra Memory) | Extreme memory | x2idn.32xlarge | SAP HANA, large in-memory databases |
| I (IO) | Storage optimized (NVMe SSD) | i4i.xlarge | NoSQL databases, data warehousing |
| D (Dense) | Storage optimized (HDD) | d3.xlarge | MapReduce, HDFS, distributed file systems |
| H (High Disk) | Storage optimized (HDD) | h1.2xlarge | MapReduce, distributed computing |
| P (GPU) | Accelerated computing | p5.48xlarge | ML training, deep learning |
| G (Graphics) | Graphics-intensive | g5.xlarge | Video encoding, 3D rendering, game streaming |
| Inf (Inference) | ML inference | inf2.xlarge | ML inference at low cost |
| Trn (Training) | ML training | trn1.32xlarge | ML training at low cost |
On the Exam: "Compute-intensive batch processing" → C-series. "In-memory caching with large datasets" → R-series. "Burstable web server for development" → T-series. "Machine learning training" → P-series or Trn-series.
EC2 Purchasing Options
| Option | Commitment | Savings | Best For |
|---|---|---|---|
| On-Demand | None | 0% (baseline) | Unpredictable workloads, short-term, testing |
| Reserved Instance (RI) | 1 or 3 years | Up to 72% | Steady-state, predictable usage (databases, core apps) |
| Savings Plans | 1 or 3 years ($/hour commitment) | Up to 72% | Flexible across instance types/Regions/OS |
| Spot Instances | None | Up to 90% | Fault-tolerant, flexible workloads (batch, CI/CD, analytics) |
| Dedicated Hosts | On-Demand or Reserved | Varies | License compliance (per-socket, per-core licensing) |
| Dedicated Instances | On-Demand pricing | Small premium | Compliance (hardware not shared with other accounts) |
| Capacity Reservations | None (pay On-Demand rate) | 0% (guarantees capacity) | Ensure capacity availability in a specific AZ |
Reserved Instance Details
| Type | Flexibility | Discount |
|---|---|---|
| Standard RI | Fixed instance type, platform, tenancy | Highest discount (up to 72%) |
| Convertible RI | Can change instance type, platform, tenancy | Lower discount (up to 66%) |
Payment options: All Upfront (max discount) > Partial Upfront > No Upfront (least discount)
Savings Plans
| Plan Type | Covers | Flexibility |
|---|---|---|
| Compute Savings Plan | EC2, Lambda, Fargate | Any instance family, size, OS, Region, tenancy |
| EC2 Instance Savings Plan | EC2 only | Fixed instance family and Region; flexible size, OS |
On the Exam: "Most cost-effective for steady-state database workload running 24/7" → Reserved Instance (3-year, All Upfront). "Batch processing that can be interrupted" → Spot Instance.
Spot Instance Details
| Feature | Detail |
|---|---|
| Savings | Up to 90% off On-Demand |
| Interruption | AWS can reclaim with 2-minute warning |
| Best for | Batch jobs, data analysis, image processing, CI/CD, testing |
| NOT for | Databases, stateful applications, critical workloads |
| Spot Fleet | Mix of Spot and On-Demand instances with target capacity |
| Spot Block | Deprecated — use Spot with interruption handling instead |
Placement Groups
| Type | Description | Use Case | Limits |
|---|---|---|---|
| Cluster | All instances in same rack, same AZ | Low-latency HPC, big data (10 Gbps between instances) | Single AZ only |
| Spread | Instances on different hardware (racks) | High availability for critical instances | Max 7 instances per AZ |
| Partition | Instances in logical partitions on different racks | HDFS, HBase, Cassandra (rack-aware distributed systems) | Up to 7 partitions per AZ |
On the Exam: "Low network latency between EC2 instances for an HPC application" → Cluster placement group. "Maximize availability for a small set of critical instances" → Spread placement group.
A company runs a high-performance computing (HPC) application that requires the lowest possible network latency between EC2 instances. Which placement group should they use?
A data analytics workload runs for 3 hours daily and can tolerate interruptions. Which EC2 purchasing option provides the MOST cost savings?
Which EC2 instance family is BEST for an application that requires large amounts of memory for an in-memory database like Redis?