4.1 Compute Cost Optimization — Right-Sizing, RIs, Savings Plans, and Spot

Key Takeaways

  • Right-sizing means choosing the smallest instance type that meets your performance requirements — AWS Cost Explorer and Compute Optimizer provide recommendations.
  • Reserved Instances (1 or 3 year) save up to 72% for steady-state workloads; Savings Plans provide similar savings with more flexibility across instance types and Regions.
  • Spot Instances save up to 90% for fault-tolerant workloads; Spot Fleets can mix Spot and On-Demand to maintain target capacity.
  • Lambda pricing is per-invocation and per-millisecond of compute time — it is cost-effective for sporadic, event-driven workloads compared to always-running EC2.
  • Auto Scaling ensures you pay only for the capacity you need by dynamically adjusting instance count to match demand.
Last updated: March 2026

Compute Cost Optimization — Right-Sizing, RIs, Savings Plans, and Spot

Quick Answer: Right-size instances first (use Compute Optimizer). Then apply pricing models: Reserved Instances or Savings Plans for steady-state (up to 72% off), Spot for fault-tolerant (up to 90% off), and Auto Scaling to match capacity to demand. Consider Lambda for sporadic workloads to avoid paying for idle compute.

Cost Optimization Strategy

The compute cost optimization hierarchy:

  1. Right-size — Ensure you are not over-provisioning
  2. Auto Scale — Match capacity to demand (never pay for idle)
  3. Pricing model — Apply the right pricing for each workload
  4. Architecture — Consider serverless (Lambda, Fargate) for variable workloads

Right-Sizing

Right-sizing means matching instance types and sizes to your workload's actual resource needs.

Tools for Right-Sizing

ToolWhat It Does
AWS Compute OptimizerML-based recommendations for EC2, ASG, Lambda, EBS, Fargate
AWS Cost ExplorerRight-sizing recommendations based on utilization data
CloudWatch MetricsMonitor CPU, memory, network, disk utilization
AWS Trusted AdvisorIdentifies underutilized EC2 instances

Common Right-Sizing Patterns

SignalAction
CPU consistently <20%Downsize to a smaller instance type
Memory consistently <30% usedSwitch to a compute-optimized (C-series) instead of memory-optimized (R-series)
Network throughput maxed outUpsize or switch to enhanced networking instance
Burst credits accumulating on T-seriesConsider switching to a smaller instance or right-sizing

Pricing Model Comparison

ModelDiscountCommitmentBest For
On-Demand0%NoneShort-term, unpredictable, testing
Reserved InstanceUp to 72%1 or 3 yearsSteady-state 24/7 workloads (databases)
Savings PlanUp to 72%1 or 3 years ($/hr)Flexible commitment across services
Spot InstanceUp to 90%NoneFault-tolerant batch, analytics, CI/CD
Dedicated HostVariesOn-Demand or ReservedLicense compliance (BYOL)

Reserved Instances Deep Dive

Payment OptionDiscount Level
All UpfrontHighest discount
Partial UpfrontMedium discount
No UpfrontLowest discount (but still significant)
TermStandard RI DiscountConvertible RI Discount
1 Year~40%~33%
3 Year~60-72%~54-66%

Key: Standard RIs offer higher discounts but are locked to specific instance types. Convertible RIs can be exchanged for different instance types, families, OS, or tenancy.

Savings Plans Deep Dive

PlanCoversFlexibility
Compute Savings PlanEC2, Lambda, FargateAny family, size, OS, tenancy, Region
EC2 Instance Savings PlanEC2 onlyFixed family + Region; flexible size + OS
SageMaker Savings PlanSageMakerML workload optimization

How it works: You commit to a consistent amount of compute usage (measured in $/hour) for 1 or 3 years. Any usage above your commitment is billed at On-Demand rates.

On the Exam: "Most flexible cost savings for compute" → Compute Savings Plan. "Highest savings for a specific EC2 instance family" → EC2 Instance Savings Plan or Standard RI.

Spot Instance Strategies

StrategyDescription
Spot FleetRequest a mix of Spot and On-Demand instances to maintain target capacity
DiversifyUse multiple instance types and AZs to reduce interruption risk
Spot + On-Demand mixOn-Demand for baseline capacity, Spot for peak capacity
Interruption handlingDesign for 2-minute interruption notice; checkpoint and resume

Serverless Cost Optimization

ScenarioEC2 CostLambda CostWinner
10 requests/day, 1 sec each$50+/month (t3.micro 24/7)~$0.00 (within free tier)Lambda
1 million requests/day, steady$150/month (m5.large)~$60/monthLambda
100 million requests/day, steady$1,500/month (multiple EC2)~$6,000/monthEC2 (with RIs)

Rule of thumb: Lambda is more cost-effective for variable, sporadic workloads. EC2 with Reserved pricing is more cost-effective for high-volume, steady-state workloads.

Auto Scaling for Cost Optimization

Auto Scaling is not just for availability — it is a core cost optimization tool:

  • Scale in during low demand → reduce instance count → reduce cost
  • Scale out during high demand → meet demand without over-provisioning
  • Scheduled scaling → scale down during nights/weekends for business-hours apps
  • Target tracking → maintain steady utilization (e.g., 70% CPU) without waste
Test Your Knowledge

A company runs a database 24/7 on an m5.2xlarge EC2 instance with consistent utilization. They want to reduce costs without changing the instance. What pricing model provides the HIGHEST savings?

A
B
C
D
Test Your Knowledge

A company wants to optimize costs across EC2, Lambda, and Fargate without locking into specific instance types. Which pricing model should they use?

A
B
C
D
Test Your Knowledge

An application processes images uploaded by users. Processing takes 30 seconds per image and uploads are sporadic (0-1000 per hour). Which compute option is MOST cost-effective?

A
B
C
D