Introduction
AWS Savings Plans offer a flexible pricing model that provides significant savings on AWS usage. By committing to a consistent amount of usage (measured in $/hour) for a one- or three-year term, you can reduce your costs compared to On-Demand pricing.
Key Concepts
Types of Savings Plans
-
Compute Savings Plans:
- Apply to any EC2 instance usage regardless of region, instance family, operating system, or tenancy.
- Also apply to AWS Fargate and AWS Lambda usage.
-
EC2 Instance Savings Plans:
- Provide the lowest prices but are less flexible.
- Apply to a specific instance family within a region (e.g., M5 instances in US East).
Commitment Terms
- One-Year Term: Lower commitment period with moderate savings.
- Three-Year Term: Higher commitment period with maximum savings.
Payment Options
- All Upfront: Pay the entire commitment upfront for the highest discount.
- Partial Upfront: Pay part of the commitment upfront and the rest over time.
- No Upfront: Pay nothing upfront and spread the cost over the term.
Practical Example
Scenario
You have a consistent workload running on EC2 instances and want to reduce your costs. You decide to commit to a Compute Savings Plan.
Steps to Purchase a Savings Plan
-
Navigate to the AWS Management Console:
- Go to the AWS Cost Management section.
- Select "Savings Plans" from the left-hand menu.
-
Select the Type of Savings Plan:
- Choose "Compute Savings Plans" for maximum flexibility.
-
Specify the Commitment:
- Enter the hourly commitment amount (e.g., $10/hour).
-
Choose the Term and Payment Option:
- Select a one-year or three-year term.
- Choose the payment option (All Upfront, Partial Upfront, or No Upfront).
-
Review and Purchase:
- Review the details and confirm the purchase.
Example Code to Monitor Savings Plan Utilization
import boto3 # Initialize a session using Amazon Cost Explorer client = boto3.client('ce') # Define the time period for the report time_period = { 'Start': '2023-01-01', 'End': '2023-01-31' } # Define the granularity and metrics granularity = 'DAILY' metrics = ['AmortizedCommitment', 'SavingsPlanAmortizedUpfrontCommitment'] # Get the Savings Plans utilization report response = client.get_savings_plans_utilization( TimePeriod=time_period, Granularity=granularity, Metrics=metrics ) # Print the utilization report for result in response['SavingsPlansUtilizationsByTime']: print(f"Date: {result['TimePeriod']['Start']}") print(f"Amortized Commitment: {result['AmortizedCommitment']}") print(f"Savings Plan Amortized Upfront Commitment: {result['SavingsPlanAmortizedUpfrontCommitment']}") print()
Explanation
- boto3.client('ce'): Initializes a session with the Cost Explorer service.
- get_savings_plans_utilization: Retrieves the utilization data for the specified time period.
- TimePeriod: Defines the start and end dates for the report.
- Granularity: Specifies the granularity of the report (e.g., DAILY).
- Metrics: Lists the metrics to be included in the report.
Practical Exercise
Exercise
-
Scenario: You have a workload that runs consistently on m5.large instances in the US East region. Calculate the potential savings by switching from On-Demand pricing to an EC2 Instance Savings Plan for a three-year term with All Upfront payment.
-
Steps:
- Use the AWS Pricing Calculator to estimate the cost of running m5.large instances on On-Demand pricing.
- Use the same calculator to estimate the cost with an EC2 Instance Savings Plan.
- Compare the two costs to determine the savings.
Solution
-
On-Demand Pricing:
- Assume the On-Demand cost for m5.large is $0.096 per hour.
- Annual cost: $0.096 * 24 hours * 365 days = $840.96
- Three-year cost: $840.96 * 3 = $2,522.88
-
EC2 Instance Savings Plan:
- Assume the Savings Plan cost for m5.large is $0.06 per hour.
- Annual cost: $0.06 * 24 hours * 365 days = $525.60
- Three-year cost: $525.60 * 3 = $1,576.80
-
Savings:
- Total savings: $2,522.88 - $1,576.80 = $946.08
Common Mistakes and Tips
- Overcommitting: Ensure your commitment matches your actual usage to avoid paying for unused capacity.
- Choosing the Wrong Plan: Select the plan that best fits your usage pattern (Compute vs. EC2 Instance).
- Ignoring Payment Options: Consider your cash flow and choose the payment option that aligns with your financial strategy.
Conclusion
AWS Savings Plans provide a powerful way to reduce your AWS costs by committing to a consistent amount of usage. By understanding the different types of Savings Plans, commitment terms, and payment options, you can make informed decisions that align with your usage patterns and financial goals.