AWS Instances (EC2, ElastiCache, RDS, Redshift) pricing retrieval project.
Project contains one module which is designed to retrieve the AWS prices for four major AWS services that have reserved instances involved: EC2, ElastiCache, RDS and Redshift. The prices either On-Demand or Reserved (specified by user) can be retrieved to Command Line in JSON, Table (Prettytable) or CSV formats. CSV format option also saves the csv file to the folder specified by user, which is the main use case.
The undocumented AWS pricing APIa are used as the sources. The same APIs serve the data to the AWS pricing pages. Both current and previous generation instance prices are retrieved.
Latest update: New pricing scheme (noUpfront, allUpfront, PartialUpfront) compatibility for RDS and Redshift is added. Minor bugs fixed.
Created: 25 March, 2015
Updated: 19 June, 2015
@author: Ilia Semenov
@version: 2.0
Bases: object
Abstract class - base for the pricing retrieval classes for different services.
str
USD Currency used in every AWS pricing by default.
list of str
List of AWS regions.
dict of str: str
Mapping of some internal AWS region names used in few sources to the conventional ones.
| Raises: | NotImplementedError – Abstract method is not implemented. |
|---|
| Raises: | NotImplementedError – Abstract method is not implemented. |
|---|
Method for retrieving the pricing data in a clean dictionary format.
| Parameters: | url – The pricing source url. |
|---|---|
| Returns: | data – Pricing data in a dictionary format |
| Return type: | dict of dict: dict |
Method for returning a blank string instead of None.
| Parameters: | v – The value to be checked for None. |
|---|---|
| Returns: | v or “” is v is None. |
Method printing the pricing data in JSON format to Console.
| Parameters: | u (str) – Parameter specifying On-Demand (“ondemand”) or Reserved (“reserved”) pricing option. |
|---|---|
| Returns: | Pricing data in JSON string format or an error message. |
| Return type: | str |
Bases: awspricingfull.AWSPrices
EC2Prices
instance of awspricingfull.EC2Prices class containing methods for EC2 pricing retrieval.
ELCPrices
instance of awspricingfull.ELCPrices class containing methods for ElastiCache pricing retrieval.
RDSPrices
instance of awspricingfull.RDSPrices class containing methods for RDS pricing retrieval.
RSPrices
instance of awspricingfull.RSPrices class containing methods for Redshift pricing retrieval.
Method printing the pricing data in JSON format to Console.
| Parameters: | u (str) – Parameter specifying On-Demand (“ondemand”), Reserved (“reserved”) or both (“all”) pricing option. |
|---|---|
| Returns: | Pricing data in JSON string format or an error message. |
| Return type: | str |
| Parameters: |
|
|---|---|
| Returns: | Prints Full pricing in the CSV format (console). |
Bases: awspricingfull.AWSPrices
Class for retrieving the EC2 pricing. Child of awspricingfull.AWSPrices class.
str
Undocumented AWS Pricing API URL - EC2 Linux Reserved, Current Generation.
str
Undocumented AWS Pricing API URL - EC2 RHEL Reserved, Current Generation.
str
Undocumented AWS Pricing API URL - EC2 SLES Reserved, Current Generation.
str
Undocumented AWS Pricing API URL - EC2 Windows Reserved, Current Generation.
str
Undocumented AWS Pricing API URL - EC2 Windows SQL Reserved, Current Generation.
str
Undocumented AWS Pricing API URL - EC2 Windows SQL Web Reserved, Current Generation.
str
Undocumented AWS Pricing API URL - EC2 Linux Reserved, Previous Generation.
str
Undocumented AWS Pricing API URL - EC2 RHEL Reserved, Previous Generation.
str
Undocumented AWS Pricing API URL - EC2 SLES Reserved, Previous Generation.
str
Undocumented AWS Pricing API URL - EC2 Windows Reserved, Previous Generation.
str
Undocumented AWS Pricing API URL - EC2 Windows SQL Reserved, Previous Generation.
str
Undocumented AWS Pricing API URL - EC2 Windows SQL Web Reserved, Previous Generation.
str
Undocumented AWS Pricing API URL - EC2 Linux On-Demand, Current Generation.
str
Undocumented AWS Pricing API URL - EC2 RHEL On-Demand, Current Generation.
str
Undocumented AWS Pricing API URL - EC2 SLES On-Demand, Current Generation.
str
Undocumented AWS Pricing API URL - EC2 Windows On-Demand, Current Generation.
str
Undocumented AWS Pricing API URL - EC2 Windows SQL On-Demand, Current Generation.
str
Undocumented AWS Pricing API URL - EC2 Windows SQL Web On-Demand, Current Generation.
str
Undocumented AWS Pricing API URL - EC2 Linux On-Demand, Previous Generation.
str
Undocumented AWS Pricing API URL - EC2 RHEL On-Demand, Previous Generation.
str
Undocumented AWS Pricing API URL - EC2 SLES On-Demand, Previous Generation.
str
Undocumented AWS Pricing API URL - EC2 Windows On-Demand, Previous Generation.
str
Undocumented AWS Pricing API URL - EC2 Windows SQL On-Demand, Previous Generation.
str
Undocumented AWS Pricing API URL - EC2 Windows SQL Web On-Demand, Previous Generation.
dict of str: str
Mapping of On-Dermand urls to OS types.
dict of str: str
Mapping of Reserved urls to OS types.
Implementation of method for getting EC2 On-Demand pricing.
| Returns: | result – EC2 On-Demand pricing in dictionary format. |
|---|---|
| Return type: | dict of dict: dict |
Implementation of method for getting EC2 Reserved pricing.
| Returns: | result – EC2 Reserved pricing in dictionary format. |
|---|---|
| Return type: | dict of dict: dict |
| Parameters: | u (str) – Parameter specifying On-Demand (“ondemand”) or Reserved (“reserved”) pricing option. |
|---|---|
| Returns: | Prints EC2 pricing in the Pretty Table format. |
| Parameters: |
|
|---|---|
| Returns: | Prints EC2 pricing in the CSV format (console). |
Bases: awspricingfull.AWSPrices
Class for retrieving the ElastiCache pricing. Child of awspricingfull.AWSPrices class.
str
Undocumented AWS Pricing API URL - On-Demand ELC Current Generation.
str
Undocumented AWS Pricing API URL - On-Demand ELC Previous Generation.
str
Undocumented AWS Pricing - Light Reserved ELC Current Generation.
str
Undocumented AWS Pricing- Medium Reserved ELC Current Generation.
str
Undocumented AWS Pricing- Heavy Reserved ELC Current Generation.
str
Undocumented AWS Pricing- Light Reserved ELC Previous Generation.
str
Undocumented AWS Pricing- Medium Reserved ELC Previous Generation.
str
Undocumented AWS Pricing- Heavy Reserved ELC Previous Generation.
dict of str: str
Mapping of Reserved urls to Reservation types.
dict of str: str
Mapping of internal AWS ELC Type names to the conventional analogs.
Implementation of method for getting ELC On-Denand pricing.
| Returns: | result – ELC On-Denand pricing in dictionary format. |
|---|---|
| Return type: | dict of dict: dict |
Implementation of method for getting ELC Reserved pricing.
| Returns: | result – ELC Reserved pricing in dictionary format. |
|---|---|
| Return type: | dict of dict: dict |
| Parameters: | u (str) – Parameter specifying On-Demand (“ondemand”) or Reserved (“reserved”) pricing option. |
|---|---|
| Returns: | Prints ELC pricing in the Pretty Table format. |
| Parameters: |
|
|---|---|
| Returns: | Prints ELC pricing in the CSV format (console). |
Bases: awspricingfull.AWSPrices
Class for retrieving the RDS pricing. Child of awspricingfull.AWSPrices class.
str
Undocumented AWS API URL - RDS Single AZ MySQL GPL, On-Demand, Current Generation.
str
Undocumented AWS API URL - RDS Multi AZ MySQL GPL, On-Demand, Current Generation.
str
Undocumented AWS API URL - RDS Single AZ Oracle Licensed, On-Demand, Current Generation.
str
Undocumented AWS API URL - RDS Multi AZ Oracle Licensed, On-Demand, Current Generation.
str
Undocumented AWS API URL - RDS Single AZ Oracle BYOL, On-Demand, Current Generation.
str
Undocumented AWS API URL - RDS Multi AZ Oracle BYOL, On-Demand, Current Generation.
str
Undocumented AWS API URL - RDS Single AZ MS SQL Server Express Licensed, On-Demand, Current Generation.
str
Undocumented AWS API URL - RDS Single AZ MS SQL Server WEB Licensed, On-Demand, Current Generation.
str
Undocumented AWS API URL - RDS Single AZ MS SQL Server SE Licensed, On-Demand, Current Generation.
str
Undocumented AWS API URL - RDS Multi AZ MS SQL Server SE Licensed, On-Demand, Current Generation.
str
Undocumented AWS API URL - RDS Single AZ MS SQL Server BYOL, On-Demand, Current Generation.
str
Undocumented AWS API URL - RDS Multi AZ MS SQL Server BYOL, On-Demand, Current Generation.
str
Undocumented AWS API URL - RDS Single AZ Postgres On-Demand, Current Generation.
str
Undocumented AWS API URL - RDS Multi AZ Postgres, On-Demand, Current Generation.
str
Undocumented AWS API URL - RDS Single AZ MySQL GPL, On-Demand, Previous Generation.
str
Undocumented AWS API URL - RDS Multi AZ MySQL GPL, On-Demand, Previous Generation.
str
Undocumented AWS API URL - RDS Single AZ Oracle Licensed, On-Demand, Previous Generation.
str
Undocumented AWS API URL - RDS Multi AZ Oracle Licensed, On-Demand, Previous Generation.
str
Undocumented AWS API URL - RDS Single AZ Oracle BYOL, On-Demand, Previous Generation.
str
Undocumented AWS API URL - RDS Multi AZ Oracle BYOL, On-Demand, Previous Generation.
str
Undocumented AWS API URL - RDS Single AZ MS SQL Server Express Licensed, On-Demand, Previous Generation.
str
Undocumented AWS API URL - RDS Single AZ MS SQL Server WEB Licensed, On-Demand, Previous Generation.
str
Undocumented AWS API URL - RDS Single AZ MS SQL Server SE Licensed, On-Demand, Previous Generation.
str
Undocumented AWS API URL - RDS Multi AZ MS SQL Server SE Licensed, On-Demand, Previous Generation.
str
Undocumented AWS API URL - RDS Single AZ MS SQL Server BYOL, On-Demand, Previous Generation.
str
Undocumented AWS API URL - RDS Multi AZ MS SQL Server BYOL, On-Demand, Previous Generation.
str
Undocumented AWS API URL - RDS Single AZ Postgres On-Demand, Previous Generation.
str
Undocumented AWS API URL - RDS Multi AZ Postgres, On-Demand, Previous Generation.
str
Undocumented AWS API URL - RDS Single AZ MySQL GPL, Reserved, Current Generation.
str
Undocumented AWS API URL - RDS Multi AZ MySQL GPL, Reserved, Current Generation.
str
Undocumented AWS API URL - RDS Single AZ Oracle Licensed, Reserved, Current Generation.
str
Undocumented AWS API URL - RDS Multi AZ Oracle Licensed, Reserved, Current Generation.
str
Undocumented AWS API URL - RDS Single AZ Oracle BYOL, Reserved, Current Generation.
str
Undocumented AWS API URL - RDS Multi AZ Oracle BYOL, Reserved, Current Generation.
str
Undocumented AWS API URL - RDS MS SQL Server Express Licensed, Reserved Light, Current Generation.
str
Undocumented AWS API URL - RDS MS SQL Server Express Licensed, Reserved Medium, Current Generation.
str
Undocumented AWS API URL - RDS MS SQL Server Express Licensed, Reserved Heavy, Current Generation.
str
Undocumented AWS API URL - RDS MS SQL Server WEB Licensed, Reserved Light, Current Generation.
str
Undocumented AWS API URL - RDS MS SQL Server WEB Licensed, Reserved Medium, Current Generation.
str
Undocumented AWS API URL - RDS MS SQL Server WEB Licensed, Reserved Heavy, Current Generation.
str
Undocumented AWS API URL - RDS MS SQL Server SE Licensed, Reserved Light, Current Generation.
str
Undocumented AWS API URL - RDS MS SQL Server SE Licensed, Reserved Medium, Current Generation.
str
Undocumented AWS API URL - RDS MS SQL Server SE Licensed, Reserved Heavy, Current Generation.
str
Undocumented AWS API URL - RDS Single AZ MS SQL Server BYOL, Reserved, Current Generation.
str
Undocumented AWS API URL - RDS Multi AZ MS SQL Server BYOL, Reserved, Current Generation.
str
Undocumented AWS API URL - RDS Single AZ Postgres, Reserved, Current Generation.
str
Undocumented AWS API URL - RDS Multi AZ Postgres, Reserved, Current Generation.
str
Undocumented AWS API URL - RDS Single AZ MySQL GPL, Reserved, Previous Generation.
str
Undocumented AWS API URL - RDS Multi AZ MySQL GPL, Reserved, Previous Generation.
str
Undocumented AWS API URL - RDS Single AZ Oracle Licensed, Reserved, Previous Generation.
str
Undocumented AWS API URL - RDS Multi AZ Oracle Licensed, Reserved, Previous Generation.
str
Undocumented AWS API URL - RDS Single AZ Oracle BYOL, Reserved, Previous Generation.
str
Undocumented AWS API URL - RDS Multi AZ Oracle BYOL, Reserved, Previous Generation.
str
Undocumented AWS API URL - RDS MS SQL Server Express Licensed, Reserved Light, Previous Generation.
str
Undocumented AWS API URL - RDS MS SQL Server Express Licensed, Reserved Medium, Previous Generation.
str
Undocumented AWS API URL - RDS MS SQL Server Express Licensed, Reserved Heavy, Previous Generation.
str
Undocumented AWS API URL - RDS MS SQL Server WEB Licensed, Reserved Light, Previous Generation.
str
Undocumented AWS API URL - RDS MS SQL Server WEB Licensed, Reserved Medium, Previous Generation.
str
Undocumented AWS API URL - RDS MS SQL Server WEB Licensed, Reserved Heavy, Previous Generation.
str
Undocumented AWS API URL - RDS MS SQL Server SE Licensed, Reserved Light, Previous Generation.
str
Undocumented AWS API URL - RDS MS SQL Server SE Licensed, Reserved Medium, Previous Generation.
str
Undocumented AWS API URL - RDS MS SQL Server SE Licensed, Reserved Heavy, Previous Generation.
str
Undocumented AWS API URL - RDS Single AZ MS SQL Server BYOL, Reserved, Previous Generation.
str
Undocumented AWS API URL - RDS Multi AZ MS SQL Server BYOL, Reserved, Previous Generation.
str
Undocumented AWS API URL - RDS Single AZ Postgres, Reserved, Previous Generation.
str
Undocumented AWS API URL - RDS Multi AZ Postgres, Reserved, Previous Generation.
list of str
List of RDS engines.
list of str
List of RDS Multi-AZ options.
dict of str: str
Mapping of internal AWS RDS Family names to the cvonventional Multi-AZ tag.
dict of str: list of str
Mapping of AWS RDS URLs (On-Demand, Single AZ) to corresponding engine and license type.
dict of str: list of str
Mapping of AWS RDS URLs (On-Demand, Multi AZ) to corresponding engine and license type.
dict of str: list of str
Mapping of AWS RDS URLs (Reserved, Single AZ, New Pricing Scheme) to corresponding engine and license type.
dict of str: list of str
Mapping of AWS RDS URLs (Reserved, Multi AZ, New Pricing Scheme) to corresponding engine and license type.
dict of str: list of str
Mapping of AWS RDS URLs (Reserved, Old Pricing Scheme) to corresponding engine and license type.
dict of str: str
Mapping of internal AWS RDS Type names to the cvonventional analogs.
Implementation of method for getting RDS On-Denand pricing.
| Returns: | result – RDS On-Denand pricing in dictionary format. |
|---|---|
| Return type: | dict of dict: dict |
Implementation of method for getting RDS Reserved pricing.
| Returns: | result – RDS Reserved pricing in dictionary format. |
|---|---|
| Return type: | dict of dict: dict |
| Parameters: | u (str) – Parameter specifying On-Demand (“ondemand”) or Reserved (“reserved”) pricing option. |
|---|---|
| Returns: | Prints RDS pricing in the Pretty Table format. |
| Parameters: |
|
|---|---|
| Returns: | Prints RDS pricing in the CSV format (console). |
Bases: awspricingfull.AWSPrices
Class for retrieving the Redshift pricing. Child of awspricingfull.AWSPrices class.
str
Undocumented AWS Pricing API URL - On-Demand Redshift Nodes
str
Undocumented AWS Pricing API URL - Reserved Redshift Nodes, Previous Generation
str
Undocumented AWS Pricing API URL - Reserved Redshift Nodes
str
Undocumented AWS Pricing API URL - Reserved Redshift Nodes, Previous Generation
Implementation of method for getting Redshift On-Denand pricing.
| Returns: | result – Redshift On-Denand pricing in dictionary format. |
|---|---|
| Return type: | dict of dict: dict |
Implementation of method for getting Redshift Reserved pricing.
| Returns: | result – Redshift Reserved pricing in dictionary format. |
|---|---|
| Return type: | dict of dict: dict |
| Parameters: | u (str) – Parameter specifying On-Demand (“ondemand”) or Reserved (“reserved”) pricing option. |
|---|---|
| Returns: | Prints Redshift pricing in the Pretty Table format. |
| Parameters: |
|
|---|---|
| Returns: | Prints Redshift pricing in the CSV format (console). |