0
0
AWScloud~5 mins

Reserved Instances and Savings Plans in AWS - Commands & Configuration

Choose your learning style9 modes available
Introduction
Reserved Instances and Savings Plans help you save money on cloud computing by committing to use certain resources for a longer time. They reduce costs compared to paying for resources only when you use them.
When you know your application will run continuously for months or years and want to pay less.
When you want to plan your cloud budget with predictable costs.
When you want to save money on virtual machines or databases you use regularly.
When you want to avoid surprises from fluctuating hourly prices.
When you want to optimize costs for steady workloads in your cloud environment.
Commands
This command lists all your active Reserved Instances so you can see what you have reserved and how it is being used.
Terminal
aws ec2 describe-reserved-instances --filters Name=state,Values=active
Expected OutputExpected
ReservedInstances: - ReservedInstancesId: abc12345-6789-0abc-def1-234567890abc InstanceType: t3.medium State: active Start: 2023-01-01T00:00:00Z End: 2024-01-01T00:00:00Z InstanceCount: 2 Scope: Availability Zone ProductDescription: Linux/UNIX
--filters - Filter results to show only active Reserved Instances
This command shows your active Savings Plans, which are flexible pricing plans that apply to your usage and save money.
Terminal
aws savingsplans describe-savings-plans --state ACTIVE
Expected OutputExpected
SavingsPlans: - SavingsPlanId: sp-0123456789abcdef0 SavingsPlanType: Compute State: ACTIVE Start: 2023-02-01T00:00:00Z End: 2025-02-01T00:00:00Z Commitment: 10.0 Currency: USD
--state - Show only Savings Plans that are currently active
This command buys a Reserved Instance offering to save money on a specific instance type for a set period.
Terminal
aws ec2 purchase-reserved-instances-offering --reserved-instances-offering-id 12345678-90ab-cdef-1234-567890abcdef --instance-count 1
Expected OutputExpected
ReservedInstancesId: abc12345-6789-0abc-def1-234567890abc
--reserved-instances-offering-id - Specifies the ID of the Reserved Instance offering to purchase
--instance-count - Number of Reserved Instances to purchase
This command purchases a Savings Plan with a 3-year term and full upfront payment to maximize savings.
Terminal
aws savingsplans create-savings-plan --savings-plan-offering-id sp-offering-12345678 --commitment 10 --term 3 --payment-option ALL_UPFRONT
Expected OutputExpected
SavingsPlanId: sp-0123456789abcdef0
--savings-plan-offering-id - ID of the Savings Plan offering to purchase
--commitment - Hourly commitment amount in USD
--term - Length of the Savings Plan in years
--payment-option - Payment method for the Savings Plan
Key Concept

If you remember nothing else from this pattern, remember: committing to use cloud resources for a longer time saves you money compared to paying as you go.

Common Mistakes
Buying Reserved Instances without matching the instance type or region of your actual usage.
You won't get the cost savings if your usage doesn't match the Reserved Instance specifications.
Check your current usage patterns and buy Reserved Instances that match your instance types and regions.
Confusing Savings Plans with Reserved Instances and buying both without understanding differences.
You might pay for overlapping commitments and not optimize savings.
Understand that Savings Plans are more flexible and cover multiple instance types, while Reserved Instances are specific; choose based on your needs.
Not checking the state of Reserved Instances or Savings Plans before buying new ones.
You might buy unnecessary or duplicate commitments, wasting money.
Always list your active Reserved Instances and Savings Plans to avoid overlap.
Summary
Use 'aws ec2 describe-reserved-instances' to see your active Reserved Instances.
Use 'aws savingsplans describe-savings-plans' to check your active Savings Plans.
Purchase Reserved Instances or Savings Plans with specific commands to save money on long-term usage.