aws-ec2-pricing 0.1.10

Last updated:

0 purchases

aws-ec2-pricing 0.1.10 Image
aws-ec2-pricing 0.1.10 Images
Add to Cart

Description:

awsec2pricing 0.1.10

aws-ec2-pricing

Collect AWS EC2 prices from AWS API to SQL table to analyze them.

Table of contents:

Usage

download
build


Installation
Working with data

Table columns and meaning
How to run queries


Limitations
Future plans


Usage
Make sure AWS credentials are set as environment variables or are available otherwise to boto3 library
which this program uses to connect to AWS API.
Usage: ec2pricing [OPTIONS] COMMAND [ARGS]...

Options:
--version Show the version and exit.
--help Show this message and exit.

Commands:
build Build SQLite database with prices from given JSON
download Download EC2 prices to JSON file


Download all "On Demand" prices for all regions for "Shared" instances into a JSON file.
ec2pricing download


Build a SQLite database from that JSON file.
You can see an example of built database in examples/prices.db file in this repo.
ec2pricing build


The resulting file is a SQLite database with a single prices table in it.

Resulting table prices in the prices.db file has following columns:

NameDescriptionExamples
familyInstace familyGeneral purpose, Compute optimized
typeInstace type groupa1, t3a, c5
sizeInstace sizenano, micro, xlarge, 32xlarge
burstIs instance burstable?Yes, No
baseBaseline performance of CPU (%)5, 10, 100
processorName of the physical CPUAWS Graviton, AMD EPYC
bitCPU bitness32-bit, 64-bit
archCPU architecturearm, x86
tenancyInstance tenancyShared, Dedicated, Host
regionAWS RegionUS East (Ohio), EU (Ireland)
vcpuNumber of virtual cores1, 2, 32
memoryAmount of RAM0.5 GiB, 128 GiB
storageStorage typeEBS only, 1x60GB NVM
osOperating SystemLinux
normNormalization scale factor (used by AWS to compare instances)0.5, 1.0, 8.0
speedDeclared CPU clock speed2.5 GHz, Up to 3.2 Ghz. 0 GHz
actualActual CPU clock speed multiplied by baseline0.125 GHz, 2.5 Ghz
networkNetwork performanceUp to 3500 MiB
genIs it current generation of instances?Yes, No
curPrice currencyUSD, CNY
hourlyHourly price0.0255
montlyMonthly price (hourly * 24 * 30)3.844
startingDate from which Amazon offers this price2021-09-01T00:00:00Z


The built database can be opened in any SQL IDE, for example, DBeaver (open source SQL editor) or in any other way.
You can then run queries in it.
Show cheapest x86-64 virtual machines:
SELECT * FROM prices WHERE arch = 'x86'
ORDER BY monthly;

Show cheapest ARM machines in Ireland:
SELECT * FROM prices
WHERE arch = 'arm' AND region = "EU (Ireland)"
ORDER BY monthly;

Sort all machines alpabetically by their family, type and power:
SELECT * FROM prices
ORDER BY family, type, norm;


Limitations
Currently, downloaded prices are limited to instances with:

"Shared" tenancy
"Linux" operating system
Support for VPC networking
Only "On Demand" pricing, no reserved instances or saving plans
"Used" capacity reservation

All these are default settings for EC2 instances when you check prices for them on AWS pricng website.

Installation
This program is written in Python and can be installed via pip.
pip install aws-ec2-pricing

Build it and run it yourself
Set up via pip and virtual environemnt


Create a virtual environment
python3 -m venv .venv
source ./.venv/bin/activate



Install requirements into it
pip install -r requirements.txt



Run the program
python3 ec2pricing/__init__.py download



Set up via poetry


Tell poetry which version of python available in your system to use
poetry env use 3.9.7



Install dependencies and create virtual environment
poetry install



Run program
poetry run ec2pricing download




Feature plans

Static website that displays the table along with the filters
Add search filters as key-value pairs for initial price download
Search for instances other than shared or Linux based
Support saving plans, reserved instances, free tier

Copyright & License

This program is distributed under Apache 2 License.
All AWS and Amazon related trademarks or symbols are not mine.
Prices obtained through this program are not an offer and should not be treated as official.

License:

For personal and professional use. You cannot resell or redistribute these repositories in their original state.

Customer Reviews

There are no reviews.