Bird
Raised Fist0
AWScloud~15 mins

EC2 pricing models (on-demand, reserved, spot) in AWS - Deep Dive

Choose your learning style10 modes available

Start learning this pattern below

Jump into concepts and practice - no test required

or
Recommended
Test this pattern10 questions across easy, medium, and hard to know if this pattern is strong
Overview - EC2 pricing models (on-demand, reserved, spot)
What is it?
EC2 pricing models are ways Amazon Web Services charges you for using virtual computers called instances. There are three main types: on-demand, reserved, and spot. On-demand means you pay for each hour or second you use without long-term commitment. Reserved means you pay upfront or monthly for a discount by committing to use for a longer time. Spot lets you use spare capacity at a big discount but can be interrupted anytime.
Why it matters
Choosing the right pricing model saves money and fits your workload needs. Without these options, you might pay too much or have unreliable service. For example, without spot pricing, you would miss out on big savings for flexible tasks. Without reserved pricing, you might overpay for steady workloads. This flexibility helps businesses control costs and scale efficiently.
Where it fits
Before learning EC2 pricing models, you should understand what EC2 instances are and basic cloud computing concepts. After this, you can learn about cost optimization strategies and how to combine pricing models for best results.
Mental Model
Core Idea
EC2 pricing models balance cost and availability by trading off commitment, flexibility, and interruption risk.
Think of it like...
It's like renting cars: on-demand is renting by the hour with no commitment, reserved is booking a car for a whole year at a discount, and spot is renting leftover cars cheaply but they can be taken back anytime.
┌───────────────┐      ┌───────────────┐      ┌───────────────┐
│ On-Demand     │      │ Reserved      │      │ Spot          │
│ Pay per use   │      │ Commit & save │      │ Cheap but     │
│ No commitment │─────▶│ Long term use │◀─────│ interruptible │
│ Flexible      │      │ Discounted    │      │ Unpredictable │
└───────────────┘      └───────────────┘      └───────────────┘
Build-Up - 7 Steps
1
FoundationWhat is EC2 and Instances
🤔
Concept: Introduce EC2 as virtual computers in the cloud and what instances mean.
Amazon EC2 lets you run virtual computers called instances on the internet. These instances behave like real computers but run inside Amazon's data centers. You can choose different sizes and types depending on what you need.
Result
You understand EC2 instances are virtual machines you can rent to run software.
Understanding what EC2 instances are is essential before learning how their pricing works.
2
FoundationBasic Pricing Concept in Cloud
🤔
Concept: Explain pay-as-you-go pricing and why cloud providers charge this way.
Cloud providers charge based on how much you use their resources, like time running a computer or storage used. This pay-as-you-go model means you only pay for what you need, avoiding upfront hardware costs.
Result
You grasp why cloud pricing is usage-based and flexible.
Knowing pay-as-you-go helps you see why different pricing models exist to balance cost and commitment.
3
IntermediateOn-Demand Pricing Model Explained
🤔
Concept: Describe on-demand pricing as paying for compute by the hour or second with no commitment.
On-demand pricing means you launch an EC2 instance and pay for every second or hour it runs. You can stop anytime without penalty. This is good for short or unpredictable workloads.
Result
You can explain when and why to use on-demand pricing.
Understanding on-demand pricing shows how flexibility comes at a higher cost.
4
IntermediateReserved Instances and Savings
🤔
Concept: Introduce reserved instances where you commit to use for 1 or 3 years for a discount.
Reserved instances require you to commit to running an instance for a long time, like 1 or 3 years. In return, you pay less per hour. You can pay upfront or monthly. This suits steady workloads.
Result
You know how reserved pricing lowers costs for predictable use.
Recognizing reserved instances helps you plan for cost savings with commitment.
5
IntermediateSpot Instances and Interruptions
🤔Before reading on: Do you think spot instances guarantee your instance will run continuously? Commit to yes or no.
Concept: Explain spot instances as cheap but interruptible instances using spare capacity.
Spot instances let you use leftover EC2 capacity at big discounts. However, AWS can stop your instance anytime if they need the capacity back. This is good for flexible, fault-tolerant tasks like batch jobs.
Result
You understand spot pricing trades reliability for cost savings.
Knowing spot instances teaches how to leverage spare capacity for big savings with risk.
6
AdvancedCombining Pricing Models for Optimization
🤔Before reading on: Would mixing pricing models in one system save money or complicate management? Commit to your answer.
Concept: Show how real systems use a mix of on-demand, reserved, and spot to balance cost and reliability.
Many companies run core workloads on reserved instances for steady cost and use spot instances for flexible tasks to save money. On-demand fills gaps when needed. This mix optimizes cost and availability.
Result
You can design cost-effective EC2 usage strategies.
Understanding combined use of pricing models reveals practical cost management in production.
7
ExpertSpot Instance Market and Pricing Dynamics
🤔Before reading on: Do you think spot prices are fixed or fluctuate based on supply and demand? Commit to your answer.
Concept: Explain how spot prices change dynamically and how AWS manages spot capacity.
Spot prices vary based on supply and demand for spare capacity. AWS uses an internal market to allocate spot instances. Prices can rise or fall, and instances can be interrupted with a 2-minute warning. Understanding this helps design fault-tolerant systems.
Result
You grasp the economic and technical mechanism behind spot pricing.
Knowing spot market dynamics helps build resilient applications that use spot instances effectively.
Under the Hood
AWS runs EC2 instances on physical servers in data centers. On-demand instances run immediately and are billed per use. Reserved instances reserve capacity or billing discounts for a set time. Spot instances use spare capacity that AWS can reclaim anytime, managed by a dynamic pricing market that balances supply and demand.
Why designed this way?
AWS designed these models to serve different customer needs: flexibility, cost savings, and capacity utilization. On-demand offers flexibility, reserved offers predictable cost savings, and spot maximizes data center efficiency by using idle resources. Alternatives like fixed pricing or only reserved would limit customer choice or waste capacity.
┌───────────────┐      ┌───────────────┐      ┌───────────────┐
│ Physical      │      │ EC2 Instances │      │ Billing       │
│ Servers      │─────▶│ On-Demand     │─────▶│ On-Demand     │
│ (Data Center) │      │ Reserved      │      │ Reserved      │
│               │      │ Spot          │      │ Spot          │
└───────────────┘      └───────────────┘      └───────────────┘
          ▲                    ▲                    ▲
          │                    │                    │
          └─────────Dynamic Pricing & Capacity Allocation─────────┘
Myth Busters - 4 Common Misconceptions
Quick: Do you think spot instances are suitable for all workloads without risk? Commit yes or no.
Common Belief:Spot instances are just cheaper versions of on-demand and can be used for any workload safely.
Tap to reveal reality
Reality:Spot instances can be interrupted anytime with little warning, so they are not suitable for critical or stateful workloads without special handling.
Why it matters:Using spot instances for critical tasks without interruption handling can cause data loss or downtime.
Quick: Do you think reserved instances guarantee a physical server reserved only for you? Commit yes or no.
Common Belief:Reserved instances mean AWS sets aside a physical server exclusively for your use.
Tap to reveal reality
Reality:Reserved instances are a billing discount, not a physical reservation of hardware. Your instance still runs on shared hardware.
Why it matters:Misunderstanding this can lead to wrong expectations about performance isolation and availability.
Quick: Do you think on-demand pricing is always the most expensive option? Commit yes or no.
Common Belief:On-demand pricing is always the most expensive way to run EC2 instances.
Tap to reveal reality
Reality:While on-demand is usually pricier, in some cases spot prices can spike above on-demand temporarily, and reserved instances require commitment that may not fit all use cases.
Why it matters:Assuming on-demand is always costliest can lead to poor cost decisions and missed optimization opportunities.
Quick: Do you think spot prices are fixed and predictable? Commit yes or no.
Common Belief:Spot prices are fixed discounts and do not change over time.
Tap to reveal reality
Reality:Spot prices fluctuate based on supply and demand, and instances can be interrupted when prices rise or capacity is needed.
Why it matters:Ignoring price variability can cause unexpected interruptions and cost surprises.
Expert Zone
1
Reserved instances come in different types: Standard, Convertible, and Scheduled, each with tradeoffs in flexibility and savings.
2
Spot instance interruptions provide a 2-minute warning, allowing some applications to save state or gracefully shut down.
3
AWS Savings Plans offer an alternative to reserved instances by committing to spend rather than specific instance types, providing more flexibility.
When NOT to use
Avoid spot instances for critical, stateful, or latency-sensitive workloads where interruptions cause major issues. Reserved instances are not ideal if your workload is highly variable or short-term. On-demand is costly for steady, predictable workloads where reserved or savings plans are better.
Production Patterns
Many companies run core services on reserved instances or savings plans for cost predictability, use spot instances for batch processing or testing to save money, and rely on on-demand for unpredictable spikes or new deployments.
Connections
Cloud Cost Optimization
Builds-on
Understanding EC2 pricing models is foundational to mastering cloud cost optimization strategies.
Supply and Demand Economics
Same pattern
Spot pricing reflects real-world supply and demand economics applied to cloud resources, showing how market forces influence technology pricing.
Car Rental Models
Analogy-based
Comparing EC2 pricing to car rentals helps grasp tradeoffs between flexibility, cost, and commitment in resource usage.
Common Pitfalls
#1Using spot instances for critical database servers without interruption handling.
Wrong approach:Launch a production database on spot instances without backup or failover.
Correct approach:Use reserved or on-demand instances for databases and spot instances only for non-critical, fault-tolerant workloads.
Root cause:Misunderstanding spot instance interruptions and their impact on stateful services.
#2Buying reserved instances without analyzing actual usage patterns.
Wrong approach:Purchase 3-year reserved instances for all workloads blindly.
Correct approach:Analyze usage trends and commit only to steady, predictable workloads with reserved instances.
Root cause:Lack of workload usage analysis leading to wasted spending.
#3Assuming on-demand pricing is always the best for short tasks.
Wrong approach:Always use on-demand for short jobs without checking spot availability.
Correct approach:Check spot instance availability and pricing for short, flexible tasks to save costs.
Root cause:Not exploring cheaper options due to habit or lack of knowledge.
Key Takeaways
EC2 pricing models offer different ways to pay for cloud computers balancing cost, flexibility, and reliability.
On-demand pricing is flexible with no commitment but costs more per use.
Reserved instances save money by committing to long-term use but require planning.
Spot instances offer big discounts using spare capacity but can be interrupted anytime.
Combining these models strategically helps optimize cloud costs and performance.

Practice

(1/5)
1. Which EC2 pricing model allows you to pay only for the compute time you use without any long-term commitment?
easy
A. Dedicated hosts
B. Reserved instances
C. Spot instances
D. On-demand instances

Solution

  1. Step 1: Understand On-demand pricing

    On-demand instances let you pay per hour or second without any upfront commitment.
  2. Step 2: Compare with other models

    Reserved requires commitment; Spot can be interrupted; Dedicated hosts are physical servers.
  3. Final Answer:

    On-demand instances -> Option D
  4. Quick Check:

    Pay-as-you-go = On-demand [OK]
Hint: No commitment means On-demand pricing [OK]
Common Mistakes:
  • Confusing Reserved with On-demand
  • Thinking Spot is always available
  • Mixing Dedicated hosts with pricing models
2. Which of the following is the correct way to describe Spot instances in AWS EC2?
easy
A. Instances with a fixed monthly fee
B. Instances that use spare capacity and can be interrupted
C. Instances reserved for 3 years with upfront payment
D. Instances that run only on dedicated hardware

Solution

  1. Step 1: Define Spot instances

    Spot instances use spare AWS capacity and are cheaper but can be stopped anytime.
  2. Step 2: Eliminate other options

    Fixed monthly fee applies to Reserved; dedicated hardware is Dedicated hosts.
  3. Final Answer:

    Instances that use spare capacity and can be interrupted -> Option B
  4. Quick Check:

    Spot = spare capacity + interruption [OK]
Hint: Spot = cheap but can stop anytime [OK]
Common Mistakes:
  • Thinking Spot has fixed fees
  • Confusing Reserved with Spot
  • Mixing Dedicated hosts with Spot
3. You launch an EC2 instance using Spot pricing. What happens if AWS needs the capacity back?
medium
A. Your instance is stopped or terminated with a 2-minute warning
B. You are charged the full On-demand price instead
C. Your instance continues running without interruption
D. Your instance is automatically converted to Reserved pricing

Solution

  1. Step 1: Understand Spot instance interruptions

    AWS can reclaim Spot instances anytime, giving a 2-minute warning before stopping or terminating.
  2. Step 2: Check other options

    Instances do not continue uninterrupted; no automatic price change or conversion to Reserved.
  3. Final Answer:

    Your instance is stopped or terminated with a 2-minute warning -> Option A
  4. Quick Check:

    Spot interruption = 2-minute warning stop [OK]
Hint: Spot instances get 2-minute stop warning [OK]
Common Mistakes:
  • Assuming Spot instances never stop
  • Thinking Spot switches to On-demand automatically
  • Believing Spot instances run like Reserved
4. A user wants to save costs by committing to a 1-year usage but accidentally selects On-demand pricing. What is the main issue with this choice?
medium
A. On-demand pricing does not offer cost savings for long-term commitment
B. On-demand pricing requires upfront payment for 1 year
C. On-demand pricing instances cannot be launched immediately
D. On-demand pricing instances are always interrupted

Solution

  1. Step 1: Understand On-demand pricing characteristics

    On-demand pricing charges per use with no upfront or commitment discounts.
  2. Step 2: Identify the cost-saving option

    Reserved instances offer savings with 1 or 3 year commitments, unlike On-demand.
  3. Final Answer:

    On-demand pricing does not offer cost savings for long-term commitment -> Option A
  4. Quick Check:

    Commitment savings = Reserved, not On-demand [OK]
Hint: Commitment savings only with Reserved pricing [OK]
Common Mistakes:
  • Thinking On-demand requires upfront payment
  • Believing On-demand instances are delayed
  • Confusing interruption with Spot pricing
5. A company runs a critical web application that must be available 24/7 with predictable costs. They also want to reduce expenses by committing to usage. Which EC2 pricing model should they choose and why?
hard
A. Spot instances, because they are cheapest and can be interrupted
B. On-demand instances, because they have no commitment and flexible pricing
C. Reserved instances, because they offer cost savings with a commitment and stable availability
D. Dedicated hosts, because they provide physical isolation

Solution

  1. Step 1: Analyze availability and cost needs

    Critical 24/7 apps need stable availability and predictable costs.
  2. Step 2: Match pricing models to needs

    Reserved instances provide cost savings with 1 or 3 year commitment and stable availability; Spot can be interrupted; On-demand is flexible but more costly.
  3. Final Answer:

    Reserved instances, because they offer cost savings with a commitment and stable availability -> Option C
  4. Quick Check:

    Critical + savings + commitment = Reserved [OK]
Hint: Stable + savings + commitment = Reserved instances [OK]
Common Mistakes:
  • Choosing Spot for critical apps despite interruptions
  • Picking On-demand for cost savings
  • Confusing Dedicated hosts with pricing benefits