Study guide
Technical reference and lesson notes
Purpose of This Lesson
Amazon EC2 offers several purchasing and tenancy models. The correct choice depends on workload predictability, interruption tolerance, capacity requirements, licensing constraints, hardware isolation, and commitment willingness.
For the SAP-C02 exam, pricing questions are rarely just about selecting the lowest hourly rate. They usually test whether you can match a purchasing option to the workload’s operational and business requirements.
Key Concepts
On-Demand Instances
On-Demand pricing is the default option:
- No long-term commitment is required.
- Instances can be started or stopped as needed.
- It is appropriate for unpredictable, short-lived, development, testing, and newly deployed workloads.
- It generally has the highest effective price for continuously running workloads.
Use On-Demand when utilization is uncertain or the organization cannot commit to a specific level of usage.
Reserved Instances
Reserved Instances (RIs) provide a billing discount in exchange for a one- or three-year commitment. They are suitable for steady-state workloads with predictable usage, such as a production database or consistently running application tier.
The discount applies when running resources match the relevant RI attributes, which can include:
- Instance family and size
- Region or Availability Zone, depending on the RI scope
- Operating system or platform
- Tenancy
- Other attributes defined by the reservation
Reserved Instances are primarily a billing construct. A zonal RI can also provide a capacity reservation in its Availability Zone, while a regional RI generally provides more placement flexibility but does not reserve capacity in a specific Availability Zone.
#### Standard and Convertible RIs
- Standard RIs provide the largest discount but offer limited modification flexibility. Some attributes, such as Availability Zone, instance size within a size-flexible family, or platform-related characteristics, may be modified subject to AWS rules.
- Convertible RIs provide greater flexibility to exchange the reservation for another configuration, including changes to instance family, operating system, tenancy, and payment option. This flexibility generally comes with a smaller discount.
Both types support payment choices such as all upfront, partial upfront, or no upfront. Paying more upfront can reduce the effective total cost, but it increases the initial cash requirement.
Savings Plans
Savings Plans provide discounted rates in exchange for a commitment to a consistent amount of usage or spend over one or three years. Unlike an RI, the commitment is expressed as an hourly spend commitment rather than a specific reservation in the traditional model.
Important types include:
- Compute Savings Plans: The most flexible option. They can apply across instance families, regions, operating systems, and tenancy, and can also apply to services such as AWS Lambda and AWS Fargate.
- EC2 Instance Savings Plans: Offer a larger discount but require commitment to a particular EC2 instance family in a region. They allow more flexibility within that family, such as changing sizes, Availability Zones, operating systems, and tenancy.
- SageMaker Savings Plans: Apply to eligible Amazon SageMaker usage rather than general EC2 usage.
Savings Plans are useful when the organization has predictable compute spending but wants more flexibility than a narrowly scoped RI provides.
Spot Instances
Spot Instances use spare EC2 capacity at a substantial discount compared with On-Demand pricing. AWS can reclaim the capacity when it needs it for other purposes.
Spot is appropriate for fault-tolerant workloads that can tolerate interruption, checkpoint progress, or restart elsewhere. Examples include:
- Batch processing
- Data analysis and distributed processing
- Stateless web workers
- CI/CD build workers
- Containerized workloads
- Large-scale simulations
- Flexible machine learning workloads
A Spot interruption can terminate, stop, or hibernate an instance depending on the instance configuration and interruption behavior. AWS normally provides a two-minute interruption notice when possible. Applications should use interruption notices through instance metadata and can integrate event-driven handling with Amazon EventBridge.
Do not place unique, unreplicated state on a Spot Instance. Store durable data in services such as Amazon S3, Amazon EFS, or an appropriately designed Amazon EBS architecture, and use checkpoints or queue-based processing where possible.
#### Spot Fleet and EC2 Fleet
- Spot Fleet launches and maintains a target capacity of Spot Instances across selected instance types and Availability Zones.
- EC2 Fleet can request a combination of Spot and On-Demand capacity in a single request, with separate target capacities and configuration preferences.
Using multiple instance types and Availability Zones improves the chance of obtaining capacity and reduces dependence on a single Spot capacity pool.
On-Demand Capacity Reservations
An On-Demand Capacity Reservation reserves EC2 capacity in a specific Availability Zone without requiring a one- or three-year term. It is useful when an organization must be able to launch a particular instance configuration during a critical event, even if capacity is constrained.
A reservation specifies details such as:
- Availability Zone
- Instance type and attributes
- Number of instances
- Platform or operating system
- Tenancy
Capacity Reservations do not inherently provide a pricing discount. The reserved capacity is charged at the applicable On-Demand rate, whether or not it is fully used, so the reservation should be sized carefully. It can generally be canceled when no longer needed.
Capacity Reservations for Machine Learning
AWS also offers specialized capacity reservation capabilities for machine learning workloads, including Capacity Blocks for ML in supported contexts. These options are designed to obtain access to GPU capacity for a defined period, such as model training, fine-tuning, experiments, or prototypes.
The key distinction is that the goal is capacity availability for specialized accelerators, not simply the lowest compute price.
Dedicated Instances
Dedicated Instances run on hardware dedicated to a single AWS account. The underlying host is not shared with instances from other AWS customers.
They are useful when physical host isolation is required, but they provide less host-level control and visibility than Dedicated Hosts. Pricing is generally based on the instances rather than the entire physical server.
Dedicated Hosts
A Dedicated Host is a physical EC2 server allocated to one customer. It provides greater visibility and control over host placement and instance allocation, including host affinity and socket/core information.
Dedicated Hosts are commonly selected for:
- Server-bound software licenses
- Per-socket or per-core licensing models
- Compliance requirements involving dedicated physical hardware
- Workloads requiring control over instance placement on a particular host
The customer pays for the host, so Dedicated Hosts can be significantly more expensive than ordinary or Dedicated Instances. They should not be selected merely because an application needs predictable performance; use them when the licensing, compliance, or host-control requirement specifically justifies them.
EC2 and EBS Billing Details
EC2 Instance Billing
Many EC2 Linux and Windows instances use per-second billing with a one-minute minimum charge. The applicable operating system and purchase model matter, so always verify the pricing rules for the selected AMI and instance type.
Some commercial Linux distributions and licensing arrangements may use hourly billing with a minimum one-hour charge. The exam may use this distinction to test whether very short-lived instances are actually cost-effective.
The instance price is determined by the selected configuration, including factors such as:
- Instance family and size
- Operating system
- Tenancy
- Region
- Purchase option
- Additional software licensing
EBS Billing
Amazon EBS is billed based on provisioned resources rather than only the amount of user data stored. For example, a 100 GiB volume is billed as a 100 GiB volume even if only 10 GiB contains data.
Depending on the volume type, charges can include:
- Provisioned storage capacity
- Provisioned IOPS
- Provisioned throughput
- Snapshot storage and data transfer-related costs where applicable
Deleting unused volumes and right-sizing provisioned performance are important cost-optimization actions.
Architecture Decision Guide
| Requirement | Best-fit option | Reasoning | Main tradeoff |
|---|---|---|---|
| Unknown duration or unpredictable usage | On-Demand Instances | No commitment and immediate flexibility | Highest normal compute price |
| Predictable, continuously running EC2 workload | Reserved Instances or EC2 Instance Savings Plans | Discounted rate for committed usage | Reduced flexibility or commitment risk |
| Predictable compute spend across changing services or configurations | Compute Savings Plans | Broad applicability and flexibility | Requires a spend commitment |
| Workload can be interrupted and restarted | Spot Instances | Very low price using spare capacity | AWS can reclaim capacity |
| Need a mixture of Spot and On-Demand capacity | EC2 Fleet | Combines capacity strategies in one request | More scheduling and capacity-management complexity |
| Must guarantee launch capacity in one Availability Zone | On-Demand Capacity Reservation | Reserves capacity without a long-term term | Pay On-Demand rates, including for unused reservation |
| Need physical isolation from other AWS customers | Dedicated Instances | Instance-level dedicated hardware | Less host visibility and potentially higher cost |
| Need socket/core visibility or server-bound licensing | Dedicated Hosts | Entire physical host is allocated to the account | Highest cost and host-management considerations |
| Need short-term access to GPU capacity for ML training | ML capacity reservation capability | Targets accelerator availability for a defined period | Limited availability and specialized pricing |
Exam-Relevant Takeaways
- Choose On-Demand for uncertain, short-term, or experimental usage.
- Choose Reserved Instances for stable EC2 usage when the required configuration is sufficiently predictable.
- Choose Savings Plans when there is predictable compute spend but the organization wants more flexibility than a specific RI provides.
- Choose Spot Instances only when interruption is acceptable and the application can recover without data loss.
- Use multiple instance types and Availability Zones with Spot to improve capacity availability.
- A Capacity Reservation addresses capacity availability, not discount pricing.
- A zonal RI can provide capacity reservation benefits; a regional RI generally offers broader placement flexibility.
- Dedicated Instances provide physical isolation at the instance level.
- Dedicated Hosts provide an entire physical server and are the appropriate answer for host-level licensing or socket/core visibility.
- EBS charges are based on provisioned capacity and, for some volume types, provisioned performance—not merely actual data stored.
- All-upfront commitments can reduce effective cost but have cash-flow and forecasting implications.
Common Exam Traps
- Confusing a Capacity Reservation with a discount: Capacity Reservations reserve launch capacity but use On-Demand pricing.
- Using Spot for stateful production databases: Spot interruption can cause an outage or data loss unless the architecture is specifically designed for interruption and recovery.
- Choosing Dedicated Hosts for ordinary isolation needs: Dedicated Instances may satisfy physical isolation without paying for a whole host. Dedicated Hosts are mainly justified by licensing or host-level control.
- Assuming a Reserved Instance automatically reserves capacity: Only the appropriate zonal reservation provides that capacity guarantee; a regional RI is primarily a billing discount with placement flexibility.
- Selecting Standard RIs when requirements may change: Convertible RIs or Savings Plans may be more suitable when instance families, operating systems, or tenancy could change.
- Ignoring EBS provisioning: A volume with little data can still be expensive if its provisioned capacity or performance is unnecessarily large.
- Putting unique data on Spot: Durable data must be externalized or replicated before interruption occurs.
- Treating the largest discount as automatically best: A high discount is not useful if utilization is unpredictable or the workload cannot satisfy the commitment.
Real-World Engineer Notes
- Build a baseline of actual usage before purchasing commitments. Use AWS Cost Explorer and Savings Plans recommendations, but validate recommendations against planned migrations and growth.
- Separate stable baseline capacity from variable demand. A common design is Savings Plans or RIs for the baseline, On-Demand for important bursts, and Spot for interruptible overflow.
- For Spot workloads, design interruption handling before deployment. Use queues, checkpoints, idempotent processing, Auto Scaling groups, and multiple instance pools.
- Capacity Reservations should be tied to a documented business requirement, such as a disaster recovery launch plan or a known seasonal event. An idle reservation is still a cost.
- Dedicated Hosts can introduce placement and capacity-management constraints. Confirm that the required instance types and host configurations are available in the selected Region and Availability Zone.
- Commitments reduce unit cost but reduce flexibility. Account for acquisitions, architecture changes, container migrations, and changing instance generations before committing for three years.
Quick Reference Summary
- On-Demand: Maximum flexibility; no commitment; highest standard rate.
- Reserved Instances: One- or three-year commitment; strong discount for predictable EC2 configurations.
- Savings Plans: One- or three-year spend commitment; generally more flexible than RIs.
- Spot: Deep discount; interruptible spare capacity; use for fault-tolerant workloads.
- Capacity Reservation: Guarantees EC2 capacity in a specific AZ; no inherent discount.
- Dedicated Instance: Hardware isolation at the instance level.
- Dedicated Host: Entire physical host; useful for licensing and host affinity.
- EBS: Billed from provisioned capacity and applicable provisioned performance, not only used data.
Flashcards
- Q: When should EC2 On-Demand pricing be selected?
A: For unpredictable, short-term, development, testing, or noncommitted workloads.
- Q: What is the commitment period for standard and convertible Reserved Instances?
A: One or three years.
- Q: What is the main advantage of a Convertible RI over a Standard RI?
A: It allows broader exchanges, such as changing instance family, operating system, tenancy, or payment option, subject to AWS rules.
- Q: What does a Compute Savings Plan commit the customer to?
A: A consistent hourly spend on eligible compute usage for one or three years.
- Q: What is the defining risk of Spot Instances?
A: AWS can interrupt and reclaim them when capacity is needed.
- Q: How should a Spot application protect work from interruption?
A: Use durable external storage, replication, checkpointing, queues, and restartable or idempotent processing.
- Q: What is the purpose of an On-Demand Capacity Reservation?
A: To ensure EC2 launch capacity is available in a specified Availability Zone without a long-term commitment.
- Q: Does an On-Demand Capacity Reservation provide a discount?
A: No. It uses the applicable On-Demand rate.
- Q: When is a Dedicated Host preferable to a Dedicated Instance?
A: When the workload requires host-level visibility, socket/core information, host affinity, or server-bound licensing.
- Q: What does EBS billing generally depend on?
A: Provisioned storage capacity and, where applicable, provisioned IOPS or throughput—not merely the amount of data currently stored.
Practice Questions
Question 1
A company runs a batch image-processing system. Jobs can be delayed, restarted from checkpoints, and distributed across several instance types and Availability Zones. The company wants to minimize compute cost. Which option is most appropriate?
- A. Dedicated Hosts
- B. Spot Instances managed with an EC2 Fleet
- C. On-Demand Capacity Reservations
- D. Three-year Standard Reserved Instances for one instance type
Correct answer: B
Explanation: The workload is interruption-tolerant and can use multiple capacity pools, making Spot appropriate. EC2 Fleet can combine instance types and Availability Zones and can also include On-Demand capacity if a baseline is required. Dedicated Hosts and capacity reservations do not address the stated cost objective, while a narrowly scoped RI lacks the flexibility needed for variable batch capacity.
Question 2
A financial services application must be able to launch 20 m7i.4xlarge instances in a particular Availability Zone during a disaster recovery test. The organization does not want a one- or three-year commitment. Which option best satisfies the capacity requirement?
- A. Regional Reserved Instance
- B. Compute Savings Plan
- C. On-Demand Capacity Reservation
- D. Spot Fleet
Correct answer: C
Explanation: An On-Demand Capacity Reservation reserves specified EC2 capacity in a particular Availability Zone without a long-term term. It does not provide a discount, but it addresses the risk of being unable to obtain capacity during the test.
Question 3
An organization has a stable EC2 workload today, but it expects to migrate some applications to different instance families and operating systems over the next year. It wants a discounted rate while preserving flexibility across eligible compute usage. Which option is generally the best starting point?
- A. Compute Savings Plan
- B. Standard RI tied to the current instance configuration
- C. Dedicated Instance
- D. Spot Instance
Correct answer: A
Explanation: A Compute Savings Plan provides a usage-spend commitment while allowing broad changes in eligible compute usage. A Standard RI may provide a larger discount for a fixed configuration but could become poorly aligned with the migration. Dedicated and Spot options do not solve the stated commitment and flexibility requirement.
Question 4
A vendor licenses software based on the number of physical CPU sockets on the server. The application must remain associated with a known physical host. Which EC2 option should the architect recommend?
- A. Dedicated Instance
- B. Dedicated Host
- C. Regional RI
- D. Spot Instance
Correct answer: B
Explanation: Dedicated Hosts expose host-level characteristics such as sockets and cores and support host affinity. This makes them appropriate for server-bound licensing. A Dedicated Instance provides physical isolation but not the same level of host visibility and control.
Question 5
A team provisions a 500 GiB EBS volume but expects to store only 50 GiB of data. Which statement is correct?
- A. The team pays only for the 50 GiB currently containing data.
- B. The team pays for the provisioned 500 GiB, along with any applicable performance charges.
- C. EBS storage is free while the volume is attached to a stopped instance.
- D. The team should use Spot Instances to reduce the EBS storage charge.
Correct answer: B
Explanation: EBS pricing is based on provisioned volume capacity and, depending on the volume type, provisioned IOPS or throughput. EC2 purchase options do not change the fact that an oversized EBS volume incurs charges for its provisioned resources.