> ## Documentation Index
> Fetch the complete documentation index at: https://notes.kodekloud.com/llms.txt
> Use this file to discover all available pages before exploring further.

# On Demand vs Provisioned Resources for ML

> Guide comparing on-demand versus provisioned cloud resources for ML, explaining trade-offs and hybrid strategies to balance cost, reliability, and scalability

When running machine learning workloads, you must decide how to allocate compute capacity. This guide compares on-demand (pay-as-you-go) resources with provisioned capacity, explains trade-offs, and gives practical guidance to choose the best option for your ML projects.

Agenda:

* Explore the on-demand, pay-as-you-go model and its flexibility.
* Compare provisioned models that reduce cost but add commitment.
* Show how to pick a strategy that balances cost, reliability, and scalability.

<Frame>
  <img src="https://mintcdn.com/kodekloud-c4ac6d9a/w1qnyQgyqoAssjvy/images/AWS-Certified-Machine-Learning-Engineer-Associate/Deployment-and-Orchestration-of-ML-Workflows/On-Demand-vs-Provisioned-Resources-for-ML/flexibility-cost-efficiency-agenda-slide.jpg?fit=max&auto=format&n=w1qnyQgyqoAssjvy&q=85&s=23159318b2ded646ae6b79a4a266dd84" alt="The image is an agenda slide highlighting three points about flexibility and cost-efficiency in services: on-demand, provisioned options, and choosing the right type for scaling efficiently." width="1920" height="1080" data-path="images/AWS-Certified-Machine-Learning-Engineer-Associate/Deployment-and-Orchestration-of-ML-Workflows/On-Demand-vs-Provisioned-Resources-for-ML/flexibility-cost-efficiency-agenda-slide.jpg" />
</Frame>

## Provisioning models to consider

Choose provisioning based on predictability, cost tolerance, and compliance needs.

| Model              | Description                                                          | Typical savings / trade-off                                        | Best fit                                                            |
| ------------------ | -------------------------------------------------------------------- | ------------------------------------------------------------------ | ------------------------------------------------------------------- |
| On-Demand          | Pay for compute by the hour/second with no long-term contract.       | No upfront costs; higher per-unit price but maximum flexibility.   | Experiments, development, unpredictable or spiky workloads.         |
| Reserved Instances | Commit to 1–3 years for specific instance class/region.              | Up to \~72% savings vs on-demand; requires commitment.             | Predictable, long-running services (steady inference).              |
| Savings Plans      | Commit to an hourly spend to get discounts across instance families. | Flexible across instance types; lower cost than on-demand.         | Teams needing flexibility across instances with predictable spend.  |
| Spot Instances     | Use spare capacity at steep discounts (interruptible).               | Up to \~90% savings; instances can be reclaimed with short notice. | Fault-tolerant large-scale training, batch jobs with checkpointing. |
| Dedicated Hosts    | An entire physical server for single-tenant use.                     | Higher cost but required for certain licenses or compliance.       | Workloads with licensing or regulatory isolation needs.             |

<Frame>
  <img src="https://mintcdn.com/kodekloud-c4ac6d9a/w1qnyQgyqoAssjvy/images/AWS-Certified-Machine-Learning-Engineer-Associate/Deployment-and-Orchestration-of-ML-Workflows/On-Demand-vs-Provisioned-Resources-for-ML/resource-provisioning-landscape-types.jpg?fit=max&auto=format&n=w1qnyQgyqoAssjvy&q=85&s=6e8273a83281fd1f3a9dfde2b0e003ed" alt="The image illustrates a &#x22;Resource Provisioning Landscape&#x22; featuring four types: On-Demand, Reserved, Spot, and Dedicated Hosts." width="1920" height="1080" data-path="images/AWS-Certified-Machine-Learning-Engineer-Associate/Deployment-and-Orchestration-of-ML-Workflows/On-Demand-vs-Provisioned-Resources-for-ML/resource-provisioning-landscape-types.jpg" />
</Frame>

## Match instance choice to workload patterns

Workloads typically follow two demand patterns:

* Spiky / variable — e.g., many training jobs, unpredictable experiments.
* Steady / predictable — e.g., production inference endpoints with consistent traffic.

Selecting the wrong model either wastes budget (overprovisioning) or causes capacity shortages (underprovisioning). Align choice to the workload’s predictability and fault-tolerance.

## On-demand resources: when flexibility matters

On-demand instances are ideal when you cannot predict timing or scale. They require no long-term commitment and are billed only for usage, making them excellent for iterative development and bursty workloads.

<Frame>
  <img src="https://mintcdn.com/kodekloud-c4ac6d9a/w1qnyQgyqoAssjvy/images/AWS-Certified-Machine-Learning-Engineer-Associate/Deployment-and-Orchestration-of-ML-Workflows/On-Demand-vs-Provisioned-Resources-for-ML/on-demand-resources-ml-training-slide.jpg?fit=max&auto=format&n=w1qnyQgyqoAssjvy&q=85&s=7c10318bdffef3238370059597f76aec" alt="The image is a presentation slide titled &#x22;On-Demand Resources Deep Dive,&#x22; discussing how unpredictable ML training workloads utilize on-demand instances, which are billed per usage with no upfront cost." width="1920" height="1080" data-path="images/AWS-Certified-Machine-Learning-Engineer-Associate/Deployment-and-Orchestration-of-ML-Workflows/On-Demand-vs-Provisioned-Resources-for-ML/on-demand-resources-ml-training-slide.jpg" />
</Frame>

When to prefer on-demand:

* Short or uncertain training runs where long-term commitment isn’t justified.
* Development, experimentation, and rapid iteration cycles.
* Handling sudden traffic spikes or unplanned compute needs.

<Frame>
  <img src="https://mintcdn.com/kodekloud-c4ac6d9a/w1qnyQgyqoAssjvy/images/AWS-Certified-Machine-Learning-Engineer-Associate/Deployment-and-Orchestration-of-ML-Workflows/On-Demand-vs-Provisioned-Resources-for-ML/on-demand-resources-ml-training-slide.jpg?fit=max&auto=format&n=w1qnyQgyqoAssjvy&q=85&s=7c10318bdffef3238370059597f76aec" alt="The image is a presentation slide titled &#x22;On-Demand Resources Deep Dive,&#x22; discussing how unpredictable ML training workloads utilize on-demand instances, which are billed per usage with no upfront cost." width="1920" height="1080" data-path="images/AWS-Certified-Machine-Learning-Engineer-Associate/Deployment-and-Orchestration-of-ML-Workflows/On-Demand-vs-Provisioned-Resources-for-ML/on-demand-resources-ml-training-slide.jpg" />
</Frame>

## Provisioned options: optimize for cost

When usage is predictable, provisioned models significantly lower costs. Use reserved commitments when you can forecast steady usage, and use spot for fault-tolerant workloads to maximize savings.

<Frame>
  <img src="https://mintcdn.com/kodekloud-c4ac6d9a/w1qnyQgyqoAssjvy/images/AWS-Certified-Machine-Learning-Engineer-Associate/Deployment-and-Orchestration-of-ML-Workflows/On-Demand-vs-Provisioned-Resources-for-ML/cloud-services-provisioned-options-diagram.jpg?fit=max&auto=format&n=w1qnyQgyqoAssjvy&q=85&s=8e2f2290dba1519fd1b8aae97d949fa4" alt="The image outlines four provisioned options for cloud services: Reserved Instances, Savings Plans, Spot, and Dedicated Hosts, each offering different savings and usage benefits." width="1920" height="1080" data-path="images/AWS-Certified-Machine-Learning-Engineer-Associate/Deployment-and-Orchestration-of-ML-Workflows/On-Demand-vs-Provisioned-Resources-for-ML/cloud-services-provisioned-options-diagram.jpg" />
</Frame>

Provisioned use cases:

* Steady inference workloads: use Reserved Instances or Savings Plans to reduce long-term costs.
* Large-scale training: use Spot Instances plus checkpointing to keep costs low while tolerating interruptions.
* Compliance-sensitive workloads: use Dedicated Hosts when isolation or specific licensing is required.

<Frame>
  <img src="https://mintcdn.com/kodekloud-c4ac6d9a/w1qnyQgyqoAssjvy/images/AWS-Certified-Machine-Learning-Engineer-Associate/Deployment-and-Orchestration-of-ML-Workflows/On-Demand-vs-Provisioned-Resources-for-ML/provisioned-use-cases-reserved-spot-dedicated.jpg?fit=max&auto=format&n=w1qnyQgyqoAssjvy&q=85&s=7f403983820efe7dab6013dd03e3a0f3" alt="The image outlines three provisioned use cases: Reserved/Savings Plans for steady inference workloads, Spot for large-scale, fault-tolerant training jobs, and Dedicated (which is not described)." width="1920" height="1080" data-path="images/AWS-Certified-Machine-Learning-Engineer-Associate/Deployment-and-Orchestration-of-ML-Workflows/On-Demand-vs-Provisioned-Resources-for-ML/provisioned-use-cases-reserved-spot-dedicated.jpg" />
</Frame>

## Hybrid strategy: balance cost and reliability

A hybrid approach often yields the best balance:

* Run the majority (for example, 70–90%) of non-critical distributed training on Spot Instances to maximize cost savings.
* Keep a minority (for example, 10–30%) as On-Demand capacity to ensure critical tasks complete when spot nodes are reclaimed.
* Use Reserved Instances or Savings Plans for long-running inference services to lock in discounts.

This mix captures most cost benefits of spot capacity while preserving enough stable capacity for reliability.

## Cost optimization best practices

* Right-size instances: choose instance families and sizes that match CPU, memory, GPU, and I/O needs.
* Build fault-tolerance: use managed spot training, frequent checkpoints, and job retries for distributed jobs.
* Apply Savings Plans or Reserved Instances where usage is consistent.
* Monitor utilization and adjust commitments regularly (e.g., [AWS CloudWatch](https://learn.kodekloud.com/user/courses/aws-cloudwatch) or your provider’s monitoring tools).
* Automate lifecycle: use autoscaling and orchestration to spin instances up and down based on demand.

<Frame>
  <img src="https://mintcdn.com/kodekloud-c4ac6d9a/w1qnyQgyqoAssjvy/images/AWS-Certified-Machine-Learning-Engineer-Associate/Deployment-and-Orchestration-of-ML-Workflows/On-Demand-vs-Provisioned-Resources-for-ML/cloud-cost-optimization-best-practices.jpg?fit=max&auto=format&n=w1qnyQgyqoAssjvy&q=85&s=e2566bbc7758b330c45177e1916c5c0d" alt="The image outlines four cost optimization best practices for cloud computing: right-sizing instances, using managed spot training, applying savings plans, and tracking utilization with CloudWatch." width="1920" height="1080" data-path="images/AWS-Certified-Machine-Learning-Engineer-Associate/Deployment-and-Orchestration-of-ML-Workflows/On-Demand-vs-Provisioned-Resources-for-ML/cloud-cost-optimization-best-practices.jpg" />
</Frame>

<Callout icon="lightbulb" color="#1CB2FE">
  Design distributed training to tolerate spot interruptions: use frequent checkpoints, incremental saves of model state, and reliable job retry logic so progress persists when capacity is reclaimed.
</Callout>

## Common pitfalls and how to avoid them

* Expect spot interruptions: implement checkpointing, graceful shutdown handling, and orchestration that supports retries.
* Over-commitment risk: avoid locking too much capacity in Reserved Instances if usage patterns can change.
* Oversizing: measure actual utilization and right-size to prevent unnecessary spend.
* Mismatched choices: always align instance type to workload pattern — flexibility for variable workloads, provisioned capacity for predictable workloads.

## Real-world example — Acme AI Corp.

Acme AI operates large model training pipelines and production inference:

* Training: 80% of training capacity runs on Spot Instances to minimize cost. 20% runs on On-Demand to guarantee completion for critical jobs.
* Inference: steady, long-running endpoints are covered by Savings Plans to capture predictable discounts and reduce per-hour costs.

<Frame>
  <img src="https://mintcdn.com/kodekloud-c4ac6d9a/w1qnyQgyqoAssjvy/images/AWS-Certified-Machine-Learning-Engineer-Associate/Deployment-and-Orchestration-of-ML-Workflows/On-Demand-vs-Provisioned-Resources-for-ML/acme-ai-training-jobs-flowchart.jpg?fit=max&auto=format&n=w1qnyQgyqoAssjvy&q=85&s=d62a8b3a3eebc04a11573c3cfbcbb980" alt="The image depicts a flowchart illustrating a real-world scenario where ACME AI Corp uses training jobs with a mix of 80% Spot instances for cost-saving and 20% On-Demand instances to ensure job completion, culminating in inference endpoints with savings plans." width="1920" height="1080" data-path="images/AWS-Certified-Machine-Learning-Engineer-Associate/Deployment-and-Orchestration-of-ML-Workflows/On-Demand-vs-Provisioned-Resources-for-ML/acme-ai-training-jobs-flowchart.jpg" />
</Frame>

## Recap — key takeaways

* On-demand: maximum flexibility, higher cost; ideal for experimentation and unpredictable workloads.
* Provisioned (Reserved / Savings Plans): lower cost for predictable workloads; trade flexibility for savings.
* Spot: biggest cost savings, but interruptible; perfect for fault-tolerant, large-scale batch or training jobs.
* Hybrid strategies (mix of Spot + On-Demand + Savings Plans) typically balance cost and reliability best.

<Frame>
  <img src="https://mintcdn.com/kodekloud-c4ac6d9a/w1qnyQgyqoAssjvy/images/AWS-Certified-Machine-Learning-Engineer-Associate/Deployment-and-Orchestration-of-ML-Workflows/On-Demand-vs-Provisioned-Resources-for-ML/computing-options-benefits-drawbacks-summary.jpg?fit=max&auto=format&n=w1qnyQgyqoAssjvy&q=85&s=c486d7c7dab89b6cca39f5d476d64f10" alt="The image presents key takeaways about different computing options, describing them as On-Demand, Provisioned, Spot, and RIs Savings Plans, with corresponding benefits and drawbacks." width="1920" height="1080" data-path="images/AWS-Certified-Machine-Learning-Engineer-Associate/Deployment-and-Orchestration-of-ML-Workflows/On-Demand-vs-Provisioned-Resources-for-ML/computing-options-benefits-drawbacks-summary.jpg" />
</Frame>

## Links and references

* [AWS EC2 Pricing & Instance Types](https://aws.amazon.com/ec2/pricing/)
* [Amazon EC2 Spot Instances](https://aws.amazon.com/ec2/spot/)
* [AWS Savings Plans](https://aws.amazon.com/savingsplans/)
* [AWS Reserved Instances](https://aws.amazon.com/ec2/pricing/reserved-instances/)
* [AWS CloudWatch monitoring](https://learn.kodekloud.com/user/courses/aws-cloudwatch)

Use these resources to validate cost assumptions and automate optimizations for production ML workflows.

<CardGroup>
  <Card title="Watch Video" icon="video" cta="Learn more" href="https://learn.kodekloud.com/user/courses/aws-machine-learning-associates/module/c3d1a3a2-07f8-4702-8653-061263bb5db2/lesson/cfe6b9e5-e080-4d13-bb60-468e0cdf3239" />
</CardGroup>
