On-Demand and Reserved Instances
Complete the full lesson to earn 25 points
Work through each section, then tap “Mark as Complete” on the last one.
✦ Skip the page breaks and see fewer ads — read each lesson on a single page with Pro
Lesson: AWS Pricing Models - On-Demand and Reserved Instances
Introduction: Why Pricing Strategy Matters in the Cloud
When you move applications to the cloud, the traditional model of purchasing hardware—where you pay a large upfront cost for servers that might sit idle—disappears. Instead, you enter a world of dynamic, usage-based billing. While this offers immense flexibility, it also introduces a layer of complexity that can lead to significant budget overruns if not managed correctly. Understanding how Amazon Web Services (AWS) structures its pricing is not just a task for the finance department; it is a fundamental skill for engineers, architects, and technical leads who want to build sustainable infrastructure.
At the heart of AWS compute pricing are two primary models: On-Demand Instances and Reserved Instances (RIs). On-Demand provides the ultimate flexibility, allowing you to pay for computing power by the second with no long-term commitment. Reserved Instances, conversely, provide a significant discount in exchange for a commitment to use a specific instance type for a set period. Choosing between these two is rarely a binary decision. Most successful organizations operate with a blend of both, balancing the need for immediate, short-term capacity against the cost-efficiency of long-term planning. This lesson will break down how these models work, when to use each, and how to optimize your spending to ensure you are getting the most value out of your cloud investment.
Understanding On-Demand Instances
On-Demand Instances are the "pay-as-you-go" workhorses of AWS. When you launch an Amazon EC2 instance without any prior commitment, you are using the On-Demand model. You pay for the compute capacity by the second, with no long-term contracts or upfront payments required. This model is ideal for workloads that have unpredictable usage patterns, applications that are being developed or tested, or short-lived tasks that only need to run for a few hours or days.
The Mechanics of On-Demand Pricing
The cost of an On-Demand instance is fixed per hour, but AWS bills you by the second, usually with a 60-second minimum. The price varies based on the instance family, size, and the region where the instance is deployed. For example, a general-purpose t3.medium instance in the US East (N. Virginia) region will have a different price point than the same instance in the Asia Pacific (Sydney) region. Because there is no commitment, you can turn these instances on and off as needed, effectively stopping the billing clock when the instance is in a "stopped" state (though you still pay for the attached storage, such as EBS volumes).
When to Use On-Demand Instances
You should lean toward On-Demand Instances when you are in the initial stages of a project and do not yet know your traffic patterns. Because you are not tied to a contract, you can experiment with different instance sizes or families to see which one performs best for your application without worrying about termination fees or stranded capacity.
- Development and Testing: Environments that are only needed during business hours or for specific testing sprints.
- Unpredictable Spikes: Applications that experience sudden, short-term increases in traffic that cannot be anticipated.
- New Applications: During the first few months of a new service, usage data is scarce; On-Demand allows you to observe traffic before committing to a long-term plan.
- Short-term Batch Jobs: Tasks that run for a few hours to process data and then terminate.
Callout: The Flexibility Paradox While On-Demand offers the most flexibility, it is almost always the most expensive way to run a steady-state workload. The premium you pay for On-Demand is essentially the "convenience fee" for being able to walk away from the resource at any moment without financial penalty.
Deep Dive into Reserved Instances (RIs)
Reserved Instances are not physical instances that you reserve; rather, they are a billing discount applied to the use of On-Demand instances in your account. When you purchase an RI, you are essentially telling AWS, "I promise to use this specific type of compute capacity for the next one or three years." In return for this commitment, AWS provides a significant discount compared to the On-Demand rate—often up to 72% off.
Types of Reserved Instances
Understanding the different types of RIs is critical because they dictate how much flexibility you have to change your infrastructure later.
- Standard RIs: These offer the highest discount but are less flexible. You cannot change the instance family or operating system once the reservation is made. These are best for stable, long-term workloads that are unlikely to change for several years.
- Convertible RIs: These offer a slightly lower discount than Standard RIs but provide the ability to change the instance family, operating system, or tenancy throughout the term. If your application evolves from a memory-intensive workload to a compute-intensive one, you can "convert" your reservation to match the new requirements.
Payment Options for RIs
When you purchase a Reserved Instance, you have three ways to structure your payments, which impacts your overall savings and cash flow:
- All Upfront: You pay for the entire term (1 or 3 years) at once. This provides the largest discount because you are providing the capital to AWS immediately.
- Partial Upfront: You pay a portion of the cost upfront and the remainder in monthly installments over the term. This is a balance between cash flow management and discount maximization.
- No Upfront: You pay nothing at the start. You receive a monthly bill for the discounted rate over the term. This provides the smallest discount of the three options but requires zero initial capital expenditure.
Note: Even with a "No Upfront" Reserved Instance, you are still legally bound to the 1-year or 3-year term. If you stop using the instances, you are still responsible for the monthly payments for the remainder of the term.
Comparing On-Demand vs. Reserved Instances
To make an informed decision, it helps to see how these models stack up against each other across various operational dimensions.
| Feature | On-Demand | Reserved Instances |
|---|---|---|
| Commitment | None | 1 or 3 Years |
| Cost | Highest | Lowest (up to 72% savings) |
| Flexibility | High (change any time) | Low (Standard) to Medium (Convertible) |
| Payment | Pay-as-you-go | Upfront or Monthly |
| Best For | Spiky, unpredictable loads | Steady-state, predictable loads |
Practical Example: The "Lifecycle" of a Service
Imagine you are launching a new web application. In month one, you have no idea how many users will visit. You start by launching three c5.large instances using the On-Demand model. You monitor the CPU and memory usage over the first three months. You notice that your traffic is stable and you consistently have at least two instances running 24/7.
At this point, you have a "baseline" load. Instead of continuing to pay the higher On-Demand rates for these two instances, you purchase two 1-year "No Upfront" Reserved Instances for the c5.large family. Your monthly bill drops immediately for those two instances. The third instance, which handles your traffic spikes, remains on the On-Demand model to provide that necessary buffer. If your traffic grows further, you can repeat this process, purchasing more RIs as your baseline usage increases.
Implementation: How to Purchase Reserved Instances
Purchasing RIs is a straightforward process within the AWS Management Console, but it requires careful planning to ensure you are buying the correct configuration.
Step-by-Step Instructions
- Log in to the AWS Management Console: Navigate to the EC2 Dashboard.
- Locate Reserved Instances: In the left-hand navigation pane, under the "Instances" section, click on "Reserved Instances."
- Purchase Reserved Instances: Click the "Purchase Reserved Instances" button.
- Filter by Requirements: Use the search filters to select the instance type (e.g.,
m5.large), platform (e.g., Linux/UNIX), and tenancy (usually Default). - Select Offering: You will see a list of available offerings. Select the one that matches your term (1 or 3 years) and payment option (All/Partial/No Upfront).
- Add to Cart and Purchase: Once selected, add the offering to your cart and complete the purchase.
Tip: Before purchasing, use the AWS Cost Explorer tool. It provides a "Reserved Instance Recommendations" report that analyzes your past usage and suggests exactly which instances you should reserve to maximize your savings. This is the most accurate way to avoid buying more capacity than you actually need.
Best Practices and Industry Standards
Managing costs in AWS is an ongoing process, not a one-time setup. As your infrastructure grows, your strategy must adapt.
1. Start with On-Demand
Never start by purchasing Reserved Instances. Always begin with On-Demand to establish a baseline of usage. You need at least 30 to 60 days of historical data to understand your "floor"—the minimum number of instances you will always have running.
2. Implement Tagging
Use AWS resource tagging to categorize your instances by department, environment (dev, staging, prod), or project. When you view your bill, tags allow you to see exactly which teams or applications are driving your costs, making it easier to determine which workloads are candidates for Reserved Instances.
3. Review Regularly
A Reserved Instance strategy is not "set it and forget it." Set a recurring calendar reminder to review your RI utilization every quarter. If you have "stranded" RIs (reservations that are not being used because the associated instances were terminated), you may need to adjust your architecture or look into selling your RIs on the AWS Reserved Instance Marketplace.
4. Leverage Savings Plans
While this lesson focuses on On-Demand and RIs, it is important to mention Savings Plans. These are a more flexible version of Reserved Instances that apply to EC2, Fargate, and Lambda. Instead of reserving a specific instance type, you commit to a specific amount of compute usage (measured in dollars per hour). This is often easier to manage than traditional RIs.
Common Pitfalls and How to Avoid Them
Even experienced teams make mistakes when dealing with cloud pricing. Here are the most frequent errors and how to steer clear of them.
Over-provisioning
The most common mistake is launching instances that are too large for the task. If you launch a c5.4xlarge when a t3.medium would suffice, you are wasting money regardless of whether you pay On-Demand or use an RI. Always right-size your instances before committing to a reservation.
Ignoring the "Stopped" State
New users often believe that if they stop an instance, they stop paying. While this is true for the compute cost, it is false for the storage cost. An EBS volume attached to a stopped instance continues to accrue charges. If you are not going to use an instance for a long period, create a snapshot of the volume and delete the instance and the volume entirely.
Miscalculating the Term
Purchasing a 3-year RI for an application that might be deprecated in 12 months is a classic error. While the 3-year discount is deeper, the risk of "lock-in" is much higher. If you are unsure about the longevity of a service, stick to 1-year terms or use Convertible RIs.
Forgetting to Monitor Utilization
You can purchase 100 RIs, but if your auto-scaling group scales down to 10 instances, you are paying for 90 idle reservations. Always ensure that your RI count is lower than or equal to your minimum sustained instance count.
Warning: Be cautious with "No Upfront" reservations if your company has strict monthly budget caps. Even though you pay nothing upfront, you are committing to a recurring monthly expense that cannot be easily canceled. Ensure your finance team is aware of these commitments.
Code Snippet: Automating RI Monitoring
While you can use the console, managing costs at scale often requires automation. You can use the AWS CLI or SDKs to monitor your instance usage and compare it against your reservations. Below is a simple Python snippet using boto3 to list your current reservations.
import boto3
def get_reserved_instances():
# Initialize the EC2 client
ec2 = boto3.client('ec2', region_name='us-east-1')
# Describe current Reserved Instances
response = ec2.describe_reserved_instances(
Filters=[
{'Name': 'state', 'Values': ['active']}
]
)
for ri in response['ReservedInstances']:
print(f"RI ID: {ri['ReservedInstancesId']}")
print(f"Type: {ri['InstanceType']}")
print(f"Count: {ri['InstanceCount']}")
print(f"End Date: {ri['End']}")
print("-" * 20)
if __name__ == "__main__":
get_reserved_instances()
Explanation: This script connects to the AWS API, filters for currently active reservations, and prints the details. You could extend this by comparing the InstanceType and InstanceCount against your current running instance metrics from CloudWatch to identify if you have underutilized reservations.
Advanced Considerations: The Marketplace and Termination
One of the more unique aspects of AWS Reserved Instances is the Reserved Instance Marketplace. If you find yourself with RIs that you no longer need—perhaps a project was canceled or you migrated to a different technology—you can list your remaining term on the marketplace to sell it to other AWS customers. This does not guarantee a sale, but it provides a way to recoup some of your costs rather than letting the reservation go to waste.
Furthermore, it is important to understand the concept of RI Scoping. When you purchase an RI, you can scope it to a specific Availability Zone (AZ) or to a Region.
- Zonal Scope: Provides a capacity reservation in a specific AZ. This is useful if you are in a region where instance capacity is sometimes constrained.
- Regional Scope: Provides a billing discount that applies to any instance of that type in the region, regardless of the AZ. This is generally preferred for flexibility, as it allows your auto-scaling groups to move instances between AZs without losing your discount.
Summary Checklist for Cost Management
To wrap up, here is a quick checklist to follow when evaluating your compute costs:
- Analyze: Use Cost Explorer to identify steady-state versus spiky workloads.
- Right-size: Ensure you are using the smallest instance size that meets your performance needs.
- Baseline: Identify the minimum number of instances running 24/7.
- Commit: Purchase 1-year RIs (or Savings Plans) for that baseline.
- Monitor: Check for "stranded" RIs monthly.
- Automate: Use tags and scripts to track spending by project.
Key Takeaways
- On-Demand is for flexibility: Use it for unknown, spiky, or development workloads where you need to be able to terminate resources instantly without penalty.
- Reserved Instances are for stability: Use them for predictable, long-running workloads to achieve significant cost savings by committing to a 1 or 3-year term.
- Conversion matters: Standard RIs are cheaper but rigid; Convertible RIs cost slightly more but allow you to change your infrastructure configuration as your needs evolve.
- Data-driven decisions: Never buy a reservation based on a guess. Use AWS Cost Explorer and historical usage data to confirm that you have a consistent baseline of usage.
- Payment options impact cash flow: Decide whether you want to pay upfront for the maximum discount or use a monthly payment plan to preserve your current capital.
- Lifecycle management is required: You must treat your cloud infrastructure like a living system. Review your reservations regularly to ensure they still align with your current technical architecture.
- Avoid common traps: Always account for EBS storage costs, right-size your instances before reserving, and ensure your team understands that "No Upfront" RIs are still binding financial contracts.
By mastering the balance between On-Demand and Reserved Instances, you move from simply "using" the cloud to "optimizing" the cloud. This discipline not only saves money but also forces you to understand your application's performance and usage patterns at a much deeper level. Start small, gather data, and scale your commitment as your confidence in your application’s behavior grows.
Continue the course
Enjoying the courses?
Everything stays free. Pro shows fewer ads, doubles your daily points limit so you progress twice as fast, and lets you read each lesson on one page.
- ✓ Fewer advertisements
- ✓ 2× daily points limit
- ✓ Distraction-free lessons