Skip to content

Quick and dirty Python (and also PHP) API and CLI (PHP is without CLI) to get EC2 instance pricing for On-Demand and Reserved Instances

Notifications You must be signed in to change notification settings

evgeny-gridasov/ec2instancespricing

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

69 Commits
 
 
 
 
 
 
 
 

Repository files navigation

ec2instancespricing.py

Written by Eran Sandler (@erans)
Forked by Evgeny Gridasov (@evgeny-gridasov) http://eran.sandler.co.il
http://forecastcloudy.net (@forecastcloudy)

This fork is focused on getting up to date prices only for all EC2 instance types. All other features like CPUCore/RAM/Storage/etc info is supported in the main repository.

ec2instancespricing.py is a quick & dirty library and a command line interface (CLI) to get a list of all Amazon Web Services EC2 instances pricing including On-Demand, Spot, and Reserved instances (in all utilization levels).

The data is based on a set of JSON files used in the EC2 pricing page (http://aws.amazon.com/ec2/pricing/).

The original JSON files as published by Amazon don't contain the same values used throughout the EC2 API. This library/cli maps the values in the JSON files to their corresponding values used throughout the EC2 API. Such values include region names, instance type, etc.

Data can be filtered by region, instance_type and os_type.

Importing this file will allow you to use two functions: get_ec2_ondemand_instances_prices - to get the pricing of On-Demand or Spot instances get_ec2_reserved_instaces_prices - to get the pricing of reserved instances (in all utilization levels)

Running this file will activate its CLI interface in which you can get output to your console in a CSV, JSON and table formats (default is table).

To run the command line interface, you need to install:
argparse - if you are running Python < 2.7
prettytable - to get a nice table output to your console

Both of these libraries can be installed using the 'pip install' command.

ec2instancespricing.php

Adapted by Sathvik P (@sathvikp) for Doers' Guild (@DoersGuild)
http://www.doersguild.com

This contains a class named EC2InstancePrices which exposes the following methods:

  • get_ec2_ondemand_instances_prices - to get the pricing of On-Demand instances
  • get_ec2_reserved_instaces_prices - to get the pricing of reserved instances (in all utilization levels)
  • get_ec2_data - to print out both the on-demand and reserved instance data as JSON

It currently doesn't have a Command-Line-Interface

ec2marketplace.py

Written by Evgeny Gridasov http://egreex.com https://awsreport.egreex.com

ec2marketplace.py is a marketplace price ripper. Requires boto and BeautifulSoup. Both of these libraries can be installed using the 'pip install' command. You will need to export your AWS account credentials to generate the price list:

export AWS_ACCESS_KEY_ID=AKA..... export AWS_SECRET_ACCESS_KEY=.......

About

Quick and dirty Python (and also PHP) API and CLI (PHP is without CLI) to get EC2 instance pricing for On-Demand and Reserved Instances

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 100.0%