Package: aws-ec2-pricing
aws-ec2-pricingCollect AWS EC2 prices from AWS API to SQL table to analyze them.Table of contents:UsagedownloadbuildInstallationWorking with dataTable columns and meaningHow to run queriesLimitationsFuture plansUsageMake sure AWS credentials are set as environment variables or are available otherwise toboto3library
which this program uses to connect to AWS API.Usage:ec2pricing[OPTIONS]COMMAND[ARGS]...

Options:--versionShowtheversionandexit.--helpShowthismessageandexit.

Commands:buildBuildSQLitedatabasewithpricesfromgivenJSONdownloadDownloadEC2pricestoJSONfileDownload all "On Demand" prices for all regions for "Shared" instances into a JSON file.ec2pricingdownloadBuild a SQLite database from that JSON file.You can see an example of built database inexamples/prices.dbfile in this repo.ec2pricingbuildThe resulting file is a SQLite database with a singlepricestable in it.Resulting tablepricesin theprices.dbfile has following columns:NameDescriptionExamplesfamilyInstace familyGeneral purpose, Compute optimizedtypeInstace type groupa1, t3a, c5sizeInstace sizenano, micro, xlarge, 32xlargeburstIs instance burstable?Yes, NobaseBaseline performance of CPU (%)5, 10, 100processorName of the physical CPUAWS Graviton, AMD EPYCbitCPU bitness32-bit, 64-bitarchCPU architecturearm, x86tenancyInstance tenancyShared, Dedicated, HostregionAWS RegionUS East (Ohio), EU (Ireland)vcpuNumber of virtual cores1, 2, 32memoryAmount of RAM0.5 GiB, 128 GiBstorageStorage typeEBS only, 1x60GB NVMosOperating SystemLinuxnormNormalization scale factor (used by AWS to compare instances)0.5, 1.0, 8.0speedDeclared CPU clock speed2.5 GHz, Up to 3.2 Ghz. 0 GHzactualActual CPU clock speed multiplied by baseline0.125 GHz, 2.5 GhznetworkNetwork performanceUp to 3500 MiBgenIs it current generation of instances?Yes, NocurPrice currencyUSD, CNYhourlyHourly price0.0255montlyMonthly price (hourly * 24 * 30)3.844startingDate from which Amazon offers this price2021-09-01T00:00:00ZThe 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*FROMpricesWHEREarch='x86'ORDERBYmonthly;Show cheapest ARM machines in Ireland:SELECT*FROMpricesWHEREarch='arm'ANDregion="EU (Ireland)"ORDERBYmonthly;Sort all machines alpabetically by their family, type and power:SELECT*FROMpricesORDERBYfamily,type,norm;LimitationsCurrently, downloaded prices are limited to instances with:"Shared" tenancy"Linux" operating systemSupport for VPC networkingOnly "On Demand" pricing, no reserved instances or saving plans"Used" capacity reservationAll these are default settings for EC2 instances when you check prices for them on AWS pricng website.InstallationThis program is written in Python and can be installed viapip.pipinstallaws-ec2-pricingBuild it and run it yourselfSet up via pip and virtual environemntCreate a virtual environmentpython3-mvenv.venvsource./.venv/bin/activateInstall requirements into itpipinstall-rrequirements.txtRun the programpython3ec2pricing/__init__.pydownloadSet up via poetryTell poetry which version of python available in your system to usepoetryenvuse3.9.7Install dependencies and create virtual environmentpoetryinstallRun programpoetryrunec2pricingdownloadFeature plansStatic website that displays the table along with the filtersAdd search filters as key-value pairs for initial price downloadSearch for instances other than shared or Linux basedSupport saving plans, reserved instances, free tierCopyright & LicenseThis 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.