Study guide
Technical reference and lesson notes
Purpose of This Lesson
Amazon EC2 pricing options are designed for different workload durations, interruption tolerances, capacity requirements, and hardware-isolation needs. SAP-C02 questions often describe a workload indirectly and expect you to select the pricing or tenancy option that best matches the scenario.
The key decision factors are:
- Whether the workload is short-term or steady-state
- Whether interruption is acceptable
- Whether capacity must be guaranteed in a specific Availability Zone
- Whether the workload is cost-sensitive
- Whether licensing or compliance requires dedicated physical hardware
Key Concepts
On-Demand Instances
On-Demand Instances are appropriate when compute capacity is needed for a short or uncertain period and the workload cannot tolerate Spot interruptions. They do not require a long-term commitment, but the hourly cost is generally higher than discounted purchasing options.
Typical use cases include:
- A developer running a small project for several hours
- Temporary testing or experimentation
- A workload whose duration or capacity requirements are uncertain
- Applications that cannot be designed to recover from an interruption
On-Demand pricing does not mean the instance can never be stopped by an administrator or terminated by an application. It means there is no Spot-style interruption caused by EC2 capacity reclamation.
Reserved Instances
Reserved Instances are best suited to predictable, continuous usage over an extended period. They provide a pricing commitment in exchange for lower rates than equivalent On-Demand usage, subject to the reservation configuration and terms.
Use Reserved Instances when:
- Demand is steady and predictable
- The workload is business-critical
- The organization expects to run the capacity for a long period
- The instance configuration and purchasing commitment are understood
Reserved Instances are a poor fit for short-lived projects or workloads whose size and configuration are likely to change significantly.
Capacity Reservations
A Capacity Reservation reserves EC2 capacity in a specific Availability Zone. It is used when the primary concern is ensuring that instances can be launched when required, rather than obtaining a pricing discount.
Capacity Reservations are useful for:
- Business-critical workloads with a known future capacity requirement
- Temporary or On-Demand workloads that still need guaranteed capacity
- Workloads that must launch in a particular Availability Zone
The organization pays for the reserved capacity, whether or not it is fully used. Capacity Reservations and Reserved Instances solve different problems: Reserved Instances primarily address pricing commitment, while Capacity Reservations address capacity availability.
Spot Instances
Spot Instances use spare EC2 capacity at a substantial discount, but AWS can interrupt them when the capacity is needed back. They are suitable only when the application can tolerate interruption and recover without losing important work.
Good candidates include:
- Distributed batch processing
- Machine learning training jobs designed to checkpoint progress
- Analytics workloads that can retry failed tasks
- Stateless workers behind a queue or scheduler
- Rendering and other parallel compute jobs
A Spot-based architecture should externalize durable data and progress. Examples include storing input and output in Amazon S3, checkpointing state, using queues for work distribution, and designing workers to restart safely.
Dedicated Instances
Dedicated Instances run on hardware dedicated to a single AWS customer, preventing them from sharing the underlying hardware with instances belonging to other customers. They are billed on an instance basis.
They can be appropriate when hardware isolation is required but visibility into the physical host’s socket and core layout is not needed.
Dedicated Hosts
A Dedicated Host provides an entire physical EC2 server dedicated to one customer. It gives visibility and control over the host’s sockets and physical cores, which can be important for certain per-socket or per-core software licenses.
Dedicated Hosts are commonly selected when:
- Third-party software licensing is tied to physical sockets or cores
- The organization needs visibility into the physical server
- A licensing agreement requires dedicated host hardware
Dedicated Hosts generally cost more than Dedicated Instances because they provide a higher level of control and physical-host allocation.
Architecture Decision Guide
| Requirement | Best-fit EC2 option | Reason |
|---|---|---|
| Short-term workload that cannot tolerate Spot interruption | On-Demand Instance | No long-term commitment and no Spot capacity reclamation |
| Steady, predictable workload with continuous demand | Reserved Instance | Lower effective cost for committed usage |
| Guaranteed EC2 capacity in a particular Availability Zone | Capacity Reservation | Reserves capacity in the required AZ |
| Cost-sensitive distributed workload that can be interrupted | Spot Instance | Uses spare capacity at a significant discount |
| Hardware isolation with instance-based billing | Dedicated Instance | Prevents sharing the underlying hardware with other customers |
| Per-socket or per-core licensing tied to a physical server | Dedicated Host | Provides dedicated host visibility and control |
Exam-Relevant Takeaways
- Choose On-Demand for short-term, unpredictable, or noninterruptible workloads when a long-term commitment is inappropriate.
- Choose Spot when cost is a major concern and the workload can handle interruption, retry, and recovery.
- Choose Reserved Instances for predictable, steady-state usage over a longer commitment period.
- Choose a Capacity Reservation when the requirement is guaranteed capacity in a specific Availability Zone.
- A Capacity Reservation is about capacity availability, not necessarily a discounted price.
- Choose Dedicated Instances when instances must run on hardware dedicated to one customer and instance-level billing is sufficient.
- Choose Dedicated Hosts when physical host visibility is required, especially for per-socket or per-core licensing.
- Spot suitability depends on application design. Saving data externally is not enough if the application cannot resume work safely.
Common Exam Traps
- Confusing Reserved Instances with Capacity Reservations: A Reserved Instance reduces the cost of predictable usage; it does not by itself guarantee that capacity will be available in a particular AZ.
- Using Spot for a nonrecoverable workload: A low price does not justify Spot when interruption would cause unacceptable data loss or downtime.
- Selecting Reserved Instances for a short project: A few hours or an uncertain project duration does not justify a long-term purchasing commitment.
- Choosing Dedicated Hosts whenever isolation is mentioned: Dedicated Instances may satisfy hardware-isolation requirements when physical socket and core visibility is unnecessary.
- Assuming On-Demand means permanent availability: On-Demand avoids Spot interruption, but instances can still be stopped, rebooted, or terminated by normal operational actions.
- Using a Dedicated Instance for socket-based licensing: Instance-level isolation does not necessarily provide the physical host information needed for per-socket licensing.
Real-World Engineer Notes
A robust Spot architecture treats interruption as a normal event rather than an exceptional failure. Use checkpointing, idempotent processing, queues, and durable storage so work can resume on another instance.
For capacity-sensitive systems, document the required Availability Zone and the quantity of capacity needed. A capacity reservation that is created in the wrong AZ does not satisfy the requirement, and unused reserved capacity still represents a cost.
For software licensing, verify the vendor’s licensing metric before selecting Dedicated Instances or Dedicated Hosts. A license described as “per instance” has different implications from one tied to physical sockets, cores, or host allocation.
The most economical option is not always the lowest hourly rate. Include commitment duration, unused capacity, interruption recovery, licensing costs, and availability requirements in the decision.
Quick Reference Summary
- On-Demand: Flexible, short-term, noninterruptible from a Spot perspective; higher price.
- Reserved Instances: Predictable long-term usage; lower effective cost through commitment.
- Capacity Reservations: Guaranteed capacity in a specified Availability Zone; not primarily a discount mechanism.
- Spot: Lowest-cost option for interruptible, distributed, recoverable workloads.
- Dedicated Instances: Dedicated underlying hardware with instance-based billing.
- Dedicated Hosts: Entire physical host dedicated to the customer; useful for socket/core licensing.
Flashcards
- Q: Which EC2 option fits a developer’s short project that must not be interrupted by EC2 capacity reclamation?
A: On-Demand Instances.
- Q: Which EC2 option is designed for cost-sensitive batch processing that can resume after interruption?
A: Spot Instances.
- Q: What is the defining requirement for using Reserved Instances?
**A: Predictable, steady usage over a sufficiently long commitment period.
- Q: What problem does a Capacity Reservation solve?
**A: It reserves EC2 capacity in a specific Availability Zone.
- Q: Does a Capacity Reservation primarily provide a pricing discount?
**A: No. Its primary purpose is capacity availability; unused reserved capacity can still incur cost.
- Q: When are Spot Instances inappropriate?
**A: When interruption would cause unacceptable loss and the application cannot checkpoint, retry, or recover.
- Q: What is the main distinction between Dedicated Instances and Dedicated Hosts?
**A: Dedicated Instances provide hardware isolation with instance-based billing; Dedicated Hosts provide an entire host and physical socket/core visibility.
- Q: Which option is most relevant to per-socket database licensing?
**A: Dedicated Hosts.
- Q: What does a Reserved Instance primarily optimize?
**A: The effective cost of predictable EC2 usage.
- Q: What does Spot interruption require from the application?
**A: The application must preserve state or results externally and resume work safely on replacement capacity.
Practice Questions
Question 1
A company runs a distributed analytics platform. Individual workers process independent jobs from a queue, and unfinished jobs can be retried. The company wants to reduce compute costs as much as possible. Which EC2 purchasing option is most appropriate?
- A. Dedicated Hosts
- B. Reserved Instances
- C. Spot Instances
- D. Capacity Reservations
Correct answer: C. Spot Instances
Explanation: The workload is distributed, cost-sensitive, and tolerant of interruption because jobs can be retried. Spot Instances provide discounted access to spare capacity and are appropriate when the application is designed for interruption recovery.
Question 2
A payment-processing application is expected to run continuously for the next three years with relatively stable capacity requirements. Which option should the architect evaluate first to reduce the effective compute cost?
- A. Spot Instances
- B. Reserved Instances
- C. On-Demand Instances only
- D. Capacity Reservations without a purchasing commitment
Correct answer: B. Reserved Instances
Explanation: Continuous, predictable, long-term usage is the classic Reserved Instance use case. Spot is unsuitable for a workload that cannot tolerate interruption, while On-Demand does not provide the same commitment-based savings.
Question 3
A company must launch a critical application in us-east-1a during a planned event. The application uses On-Demand Instances, and failure to obtain capacity at launch would cause a major outage. Which capability addresses this requirement?
- A. Reserved Instance pricing
- B. Spot Fleet interruption handling
- C. Capacity Reservation in
us-east-1a - D. Dedicated Instance tenancy in another Availability Zone
Correct answer: C. Capacity Reservation in us-east-1a
Explanation: A Capacity Reservation is designed to ensure EC2 capacity is available in a specified Availability Zone. Reserved Instance pricing addresses cost commitment, not a specific AZ capacity guarantee.
Question 4
A commercial database is licensed according to the number of physical sockets on the underlying server. The customer requires visibility into those sockets and wants the entire server allocated to its account. Which option is the best fit?
- A. Spot Instance
- B. Dedicated Instance
- C. Dedicated Host
- D. Reserved Instance
Correct answer: C. Dedicated Host
Explanation: A Dedicated Host provides an entire physical server and visibility into its sockets and cores, making it suitable for certain host-based licensing models.
Question 5
A security-sensitive application must not share the underlying physical hardware with instances belonging to other AWS customers. The application does not require visibility into physical sockets or cores. Which option best meets the requirement without adding the extra host-level controls?
- A. Dedicated Instance
- B. Dedicated Host
- C. Spot Instance
- D. Standard Reserved Instance
Correct answer: A. Dedicated Instance
Explanation: Dedicated Instances run on hardware dedicated to one customer and are appropriate when isolation is required but physical host visibility is not. Dedicated Hosts provide additional host-level control that this scenario does not require.