EC2 Architecture & Instance Types
Amazon Elastic Compute Cloud (EC2) is the foundational web service providing resizable compute capacity in the cloud. For the SAA-C03 exam, understanding how to select the right instance type and purchasing model is critical for both performance and cost optimization.
The “Rental Vehicle” Analogy
Think of AWS EC2 like a massive vehicle rental agency:
- General Purpose (M/T): Your standard sedan. Good for everyday commuting and balanced performance.
- Compute Optimized (C): A high-performance sports car. Built for speed and processing power, but less trunk space (RAM).
- Memory Optimized (R): A large moving truck. It can carry massive loads of data in its “cargo hold” (RAM) for real-time processing.
- Storage Optimized (I/D/H): A warehouse van. Designed for high-speed local storage delivery.
Core Concepts & Well-Architected Framework
EC2 design aligns with the Performance Efficiency and Cost Optimization pillars of the Well-Architected Framework.
- What: EC2 provides virtual machines (Instances) where you control the OS, software stack, and networking.
- Why: It enables “Vertical Scaling” (changing instance size) and “Horizontal Scaling” (adding more instances via Auto Scaling) to match demand without upfront hardware costs.
Comparison: EC2 Instance Families
| Family | Primary Strength | Best Use Case |
|---|---|---|
| General Purpose (T, M) | Balance of CPU, Memory, Network | Web servers, small databases, dev environments. |
| Compute Optimized (C) | High-performance processors | Batch processing, media encoding, high-perf web servers. |
| Memory Optimized (R, X, High Mem) | Large RAM footprints | In-memory databases (SAP HANA, Redis), big data analytics. |
| Storage Optimized (I, D, H) | High, sequential R/W or IOPS | NoSQL databases, Data warehousing, Log processing. |
| Accelerated (P, G, F) | Hardware accelerators (GPU/FPGA) | Machine Learning, Graphics rendering, Genomics. |
Scenario-Based Decision Matrix
- If the workload is interruptible and you want 90% savings ➔ Use Spot Instances.
- If you have a steady-state, long-term workload (1-3 years) ➔ Use Reserved Instances or Savings Plans.
- If you need to run a legacy software with strict per-socket licensing ➔ Use Dedicated Hosts.
- If you need the highest performance for a distributed ML cluster ➔ Use Cluster Placement Groups.
Exam Tips: Golden Nuggets
- Spot Instances: If AWS terminates them, you don’t pay for the partial hour. If you terminate them, you pay for the full hour.
- Instance Metadata: Accessible at
http://169.254.169.254/latest/meta-data/. It contains the public IP, instance ID, etc. - Termination Protection: This is turned OFF by default. You must enable it to prevent accidental API deletions.
- EBS-Optimized: Always choose EBS-optimized instances for workloads requiring dedicated throughput to storage.
EC2 Architecture Visual Guide
Key Services
AMI: The blueprint (OS, software) for your instance. Regional scope.
User Data: Scripts that run once at the first boot for bootstrapping.
Common Pitfalls
On-Demand for everything: Leads to 50-70% higher costs than necessary.
Vertical Scaling only: Forgetting that EC2 should be stateless for Auto Scaling.
Quick Patterns
High Availability: Deploy instances across multiple Availability Zones (AZs).
Security: Use Security Groups (Stateful) to control traffic at the instance level.