On-Demand vs Reserved Instances
On-Demand instances are the default pricing model. Pay per second for Linux or per hour for Windows with no upfront commitment. On-Demand provides maximum flexibility but at a premium: an m6i.xlarge costs $0.192 per hour On-Demand versus $0.121 per hour with a 1-year RI (37% savings) or $0.076 per hour with a 3-year RI (60% savings).
Reserved Instances provide a discount in exchange for a 1-year or 3-year commitment. RIs are tied to specific attributes: region, availability zone, instance type, platform, and tenancy. You don't need to run the RI continuously. RIs apply automatically to matching running instances and expire when the commitment ends.
RI types include Standard RIs (highest discount, no modifications), Convertible RIs (lower discount, can change instance family or type), and Scheduled RIs (discount for predictable recurring workloads). Choose Standard for predictable workloads, Convertible for evolving needs.
Payment options affect cash flow. All Upfront provides the highest discount (additional 5 to 10%). Partial Upfront reduces initial cost. No Upfront spreads payments monthly but offers the lowest discount. For a 3-year RI on an m6i.xlarge: All Upfront saves 62%, Partial Upfront saves 59%, No Upfront saves 56%.
The RI Marketplace enables selling unused RIs. If your workload changes, list it on the Marketplace. Other AWS customers can purchase your RI and you receive a refund minus a small fee. This reduces the risk of over-committing.
Decision framework: If you're confident an instance will run 24/7 for 3 plus years, buy a 3-year All Upfront RI for maximum savings. If you're less certain, buy a 1-year Standard RI. If you need flexibility to change instance types, buy a Convertible RI. For variable workloads, skip RIs and use Savings Plans or Spot.
Savings Plans: Compute and EC2 Instance
Savings Plans are a newer, more flexible commitment model. Unlike RIs tied to specific instance attributes, Savings Plans apply to usage across instance families, sizes, operating systems, and tenancies within a region.
Compute Savings Plans offer the broadest flexibility. Commit to a fixed dollar amount per hour for 1 or 3 years. This commitment applies to EC2, Fargate, and Lambda. An EC2 instance, a Lambda function, and Fargate containers all draw from the same Compute Savings Plan commitment. This is ideal for organizations using multiple compute services.
EC2 Instance Savings Plans provide a deeper discount (up to 72%) in exchange for less flexibility. Commit to a specific instance family such as M6 in a specific region. The plan applies across sizes, operating systems, and tenancies. This is ideal when you are committed to a family but may scale up or down.
Savings Plans are applied automatically. No need to manage individual RI inventory. The AWS billing engine applies the commitment to eligible usage, prioritizing the highest-discount options first. This eliminates the complexity of matching RIs to instances.
The Savings Plans console analyzes your On-Demand spend and recommends commitments that maximize savings. Recommendations include commitment amount, expected savings, break-even point, and coverage forecast. The recommendations consider your historical usage and forecasted growth.
Example: A company spends $50,000 per month On-Demand on EC2. Compute Savings Plans recommendations show a $25 per hour commitment saves $20,000 per month (40% savings). The commitment covers EC2, Fargate tasks, and Lambda functions with flexibility to change instance types as the architecture evolves.
Spot Instances, Spot Fleet, and Capacity Pools
Spot Instances provide up to 90% discount compared to On-Demand in exchange for potential interruption. AWS uses spare EC2 capacity for Spot, and when demand increases, Spot instances may be terminated with a 2-minute warning. This makes Spot ideal for fault-tolerant, stateless, or batch workloads.
Interruption behavior: When AWS needs capacity back, Spot instances receive a 2-minute warning via instance metadata or CloudWatch Events. Well-designed applications handle this gracefully: save state to persistent storage, deregister from load balancers, complete in-flight work, and terminate before the forced shutdown.
Spot Fleet manages a collection of Spot instances across multiple instance types and availability zones. Define a target capacity such as 100 instances or 500 vCPUs and the fleet maintains it by launching replacements when instances are interrupted. Spot Fleet supports allocation strategies: lowestPrice (cheapest pool), diversified (spread across pools), and capacityOptimized (pools with most available capacity, fewest interruptions).
Capacity pools are groups of instances with the same instance type and availability zone. Pool availability fluctuates. capacityOptimized allocation selects pools with the most spare capacity, reducing interruption frequency by up to 50% compared to lowestPrice.
Spot best practices: Use multiple instance types and AZs to increase pool availability. Set a maximum price or use the default On-Demand price as a ceiling. Implement checkpointing for long-running jobs. Use Capacity Optimized pools for more predictable availability.
Spot use cases: CI/CD build fleets, data processing with EMR, Spark, or Athena, machine learning training for hyperparameter sweeps, rendering for 3D rendering or video encoding, and web scraping. Avoid Spot for databases, stateful applications, single-instance workloads with no replacement strategy, or workloads with strict latency SLAs.
The Spot Instance Advisor shows current interruption rates per instance type and region. Use this data to choose instance types with historically low interruption rates. C5 and M5 families typically have lower interruption rates than newer, more popular instance types.
Pricing Tools: TCO Calculator, Pricing Pages, Cost Calculator
The AWS Pricing Calculator estimates costs before deployment. Build your architecture by adding services: specify EC2 instances, RDS databases, S3 storage, data transfer, and other resources. The calculator generates a detailed cost breakdown by service and a monthly estimate. Use this for budgeting new projects and comparing architecture alternatives.
Example scenario: Estimate costs for a three-tier web application. Add 2 m6i.xlarge EC2 instances ($281 per month), 1 db.r6g.large RDS Multi-AZ ($350 per month), 100GB S3 ($2.30 per month), 1TB data transfer ($85 per month), and CloudFront ($85 per month). Total is approximately $803 per month. Compare this with a containerized approach on ECS Fargate or serverless with Lambda.
The Total Cost of Ownership (TCO) Calculator compares on-premises costs with AWS. Input your current infrastructure including servers, storage, network equipment, software licenses, facility costs for power, cooling, and space, and IT labor. The calculator translates these into equivalent AWS costs and shows the TCO comparison. This is a powerful tool for building a business case for cloud migration.
AWS Pricing Pages provide per-service pricing details. Each service has a pricing page showing On-Demand rates, Reserved Instance and Savings Plan discounts, data transfer costs, and request pricing. These pages are the authoritative source for cost calculations.
The Pricing API enables programmatic access to pricing data. Query current prices, filter by region, instance type, or operating system. Build custom cost estimation tools or integrate pricing data into your FinOps dashboards. The Pricing API is free but has rate limits.
Practical approach: Use the Pricing Calculator for new projects, the Pricing Pages for detailed rate lookups, and the TCO Calculator for migration business cases. Always validate estimates with actual AWS billing data. Estimates are approximations and real costs depend on actual usage patterns.
Quiz
1. What is the key difference between Compute Savings Plans and EC2 Instance Savings Plans?
2. Why use capacityOptimized allocation strategy for Spot Instances?
3. When would you choose a Convertible RI over a Standard RI?
4. A workload runs unpredictably for 3 hours per day. Which pricing model is most cost-effective?
Flashcards
Question
On-Demand vs Reserved Instances
Click to reveal answer
Answer
On-Demand: pay per second, maximum flexibility, highest cost. RIs: 1yr or 3yr commitment, 37 to 62% savings, tied to specific instance attributes.
Question
Compute Savings Plans vs EC2 Instance Savings Plans
Click to reveal answer
Answer
Compute: broadest flexibility across EC2, Fargate, Lambda, up to 66% savings. EC2 Instance: deeper discount (up to 72%) but limited to one instance family in one region.
Question
Spot Instance capacityOptimized strategy
Click to reveal answer
Answer
Selects pools with the most spare capacity, reducing interruption frequency by up to 50% compared to lowestPrice strategy.
Question
AWS TCO Calculator purpose
Click to reveal answer
Answer
Compares on-premises infrastructure costs (servers, storage, licenses, facilities, labor) with equivalent AWS costs for cloud migration business cases.
Revision Notes
Key Takeaways
- 1. On-Demand provides flexibility at a premium; RIs and Savings Plans trade commitment for 37 to 72% savings
- 2. Savings Plans are more flexible than RIs and apply across multiple compute services
- 3. Spot Instances offer up to 90% discount but require fault-tolerant, interruptible workloads
- 4. Always validate pricing estimates with actual billing data; use Calculator for planning
Interview Tips
- • Explain the tradeoffs between On-Demand, RI, Savings Plans, and Spot for different workload types
- • Design a commitment strategy for a company with predictable base load and variable peak demand
- • Compare Compute Savings Plans vs EC2 Instance Savings Plans with specific cost examples
- • Describe how to handle Spot Instance interruptions in a production application
Cheat Sheet
On-Demand: max flexibility, max cost. RIs: 1yr/3yr, 37-62% savings, instance-specific. Savings Plans: flexible across families, up to 72% savings. Spot: up to 90% savings, interruptible. Calculator for planning, TCO for migration business cases.