Fetching AWS price quotes related to 3Y All Upfront Compute Savings Plan with output in an Excel file.
git clone git@github.com:longhorn09/aws_prices.git
pip3 install xlsxwriter
python3 index.py
Python script will create an Excel file with Savings Plan quotes and filename of
sp_prices.xlsx
in same folder where python script is run. Can easily filter or use vlookup()
or any other excel lookup technique such as xlookup()
or index/match
Script relies up on xlsxwriter
This is for writing to Excel workbook. To install use pip3
as shown below
pip3 install xlsxwriter
Each regional savings plan URL ranges from 40~70 MB.
The list of EC2 offers is roughly 1.3GB. Even over gigabit fiber connections, it can take a while to download/read.
Because of this, if repeatedly running this script, save the 1.3GB JSON file locally, and toggle within the getSKUListLocal
function and tweak the file name accordingly.
doLocal = True # toggle
if (doLocal):
# this is a 1.3 GB file - may take time
with open('index_aws_ec2.json') as json_file:
myJSON = json.load(json_file)
3Y Compute Savings Plan All Upfront has product sku of RQRC4CUNT9HUG9WC
{
"sku" : "RQRC4CUNT9HUG9WC",
"productFamily" : "ComputeSavingsPlans",
"serviceCode" : "ComputeSavingsPlans",
"usageType" : "ComputeSP:3yrAllUpfront",
"operation" : "",
"attributes" : {
"purchaseOption" : "All Upfront",
"granularity" : "hourly",
"purchaseTerm" : "3yr",
"locationType" : "AWS Region",
"location" : "Any"
}
}
AWS Bulk API
Savings plan offer file
JSON Editor online
AmazonEC2.currentVersionUrl (1.3GB)
AmazonEC2.currentRegionIndexUrl
AmazonEC2.currentSavingsPlanIndexUrl