{"id":17132743,"url":"https://github.com/vduseev/aws-ec2-pricing","last_synced_at":"2025-07-25T09:32:45.575Z","repository":{"id":57413266,"uuid":"406267749","full_name":"vduseev/aws-ec2-pricing","owner":"vduseev","description":"Command line tool to collect EC2 prices from AWS API and put them into SQLite table to analyze them better","archived":false,"fork":false,"pushed_at":"2023-11-27T00:20:21.000Z","size":912,"stargazers_count":1,"open_issues_count":0,"forks_count":2,"subscribers_count":2,"default_branch":"main","last_synced_at":"2024-11-30T13:44:45.993Z","etag":null,"topics":["aws","command-line","ec2","pricing","python","sql","table"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/vduseev.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-09-14T07:27:08.000Z","updated_at":"2024-05-17T19:28:20.000Z","dependencies_parsed_at":"2022-09-07T03:02:44.187Z","dependency_job_id":null,"html_url":"https://github.com/vduseev/aws-ec2-pricing","commit_stats":null,"previous_names":["vduseev/aws-ec2-pricing"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vduseev%2Faws-ec2-pricing","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vduseev%2Faws-ec2-pricing/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vduseev%2Faws-ec2-pricing/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vduseev%2Faws-ec2-pricing/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/vduseev","download_url":"https://codeload.github.com/vduseev/aws-ec2-pricing/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":227556624,"owners_count":17786355,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["aws","command-line","ec2","pricing","python","sql","table"],"created_at":"2024-10-14T19:28:05.243Z","updated_at":"2024-12-01T12:24:28.211Z","avatar_url":"https://github.com/vduseev.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# aws-ec2-pricing\n\n![Table of AWS EC2 prices in SQL](/docs/example-query.png)\n\nCollect AWS EC2 prices from AWS API to SQL table to analyze them.\n\n\u003ca href=\"https://pypi.org/project/aws-ec2-pricing/\"\u003e\u003cimg alt=\"PyPI\" src=\"https://img.shields.io/pypi/v/aws-ec2-pricing?logo=pypi\u0026color=blue\"\u003e\u003c/a\u003e\n\n**Table of contents**:\n\n* \u003ca href=\"#usage\"\u003eUsage\u003c/a\u003e\n  * \u003ca href=\"#download\"\u003edownload\u003c/a\u003e\n  * \u003ca href=\"#build\"\u003ebuild\u003c/a\u003e\n* \u003ca href=\"#installation\"\u003eInstallation\u003c/a\u003e\n* \u003ca href=\"#working\"\u003eWorking with data\u003c/a\u003e\n  * \u003ca href=\"#table\"\u003eTable columns and meaning\u003c/a\u003e\n  * \u003ca href=\"#queries\"\u003eHow to run queries\u003c/a\u003e\n* \u003ca href=\"#limitations\"\u003eLimitations\u003c/a\u003e\n* \u003ca href=\"#future\"\u003eFuture plans\u003c/a\u003e\n\n\u003ca id=\"usage\"\u003e\u003c/a\u003e\n\n## Usage\n\nMake sure AWS credentials are set as environment variables or are available otherwise to `boto3` library\nwhich this program uses to connect to AWS API.\n\nThe AWS Price List Query API is [not available in all regions](https://docs.aws.amazon.com/awsaccountbilling/latest/aboutv2/using-price-list-query-api.html#price-list-query-api-endpoints); this program defaults to using the API endpoint in `us-east-1` (N. Virginia), and permits changing regions to the other available endpoints (`eu-central-1`, Frankfurt; `ap-south-1`, Mumbai) using the `--region` option.\n\n```shell\nUsage: ec2pricing [OPTIONS] COMMAND [ARGS]...\n\nOptions:\n  --version  Show the version and exit.\n  -r, --region [us-east-1|eu-central-1|ap-south-1]\n             The AWS region to use. Limited to specific\n             regions where the Pricing API is available;\n             default: us-east-1  \n  --help     Show this message and exit.\n\nCommands:\n  build     Build SQLite database with prices from given JSON\n  download  Download EC2 prices to JSON file\n```\n\n\u003ca id=\"download\"\u003e\u003c/a\u003e\nDownload all \"On Demand\" prices for all regions for \"Shared\" instances into a JSON file.\n\n\n```shell\nec2pricing download\n```\n\n\u003ca id=\"build\"\u003e\u003c/a\u003e\nBuild a SQLite database from that JSON file.\n\n*You can see an example of built database in `examples/prices.db` file in this repo.*\n\n```shell\nec2pricing build\n```\n\n\u003ca id=\"working\"\u003e\u003c/a\u003e\n\nThe resulting file is a SQLite database with a single `prices` table in it.\n\n\u003ca id=\"table\"\u003e\u003c/a\u003e\nResulting table `prices` in the `prices.db` file has following columns:\n\n\u003ctable\u003e\n    \u003ctr\u003e\u003cth\u003eName\u003c/th\u003e\u003cth\u003eDescription\u003c/th\u003e\u003cth\u003eExamples\u003c/th\u003e\u003c/tr\u003e\n    \u003ctr\u003e\u003ctd\u003e\u003cb\u003efamily\u003c/b\u003e\u003c/td\u003e\u003ctd\u003eInstace family\u003c/td\u003e\u003ctd\u003eGeneral purpose, Compute optimized\u003c/td\u003e\u003c/tr\u003e\n    \u003ctr\u003e\u003ctd\u003e\u003cb\u003etype\u003c/b\u003e\u003c/td\u003e\u003ctd\u003eInstace type group\u003c/td\u003e\u003ctd\u003ea1, t3a, c5\u003c/td\u003e\u003c/tr\u003e\n    \u003ctr\u003e\u003ctd\u003e\u003cb\u003esize\u003c/b\u003e\u003c/td\u003e\u003ctd\u003eInstace size\u003c/td\u003e\u003ctd\u003enano, micro, xlarge, 32xlarge\u003c/td\u003e\u003c/tr\u003e\n    \u003ctr\u003e\u003ctd\u003eburst\u003c/td\u003e\u003ctd\u003eIs instance burstable?\u003c/td\u003e\u003ctd\u003eYes, No\u003c/td\u003e\u003c/tr\u003e\n    \u003ctr\u003e\u003ctd\u003ebase\u003c/td\u003e\u003ctd\u003eBaseline performance of CPU (%)\u003c/td\u003e\u003ctd\u003e5, 10, 100\u003c/td\u003e\u003c/tr\u003e\n    \u003ctr\u003e\u003ctd\u003eprocessor\u003c/td\u003e\u003ctd\u003eName of the physical CPU\u003c/td\u003e\u003ctd\u003eAWS Graviton, AMD EPYC\u003c/td\u003e\u003c/tr\u003e\n    \u003ctr\u003e\u003ctd\u003ebit\u003c/td\u003e\u003ctd\u003eCPU bitness\u003c/td\u003e\u003ctd\u003e32-bit, 64-bit\u003c/td\u003e\u003c/tr\u003e\n    \u003ctr\u003e\u003ctd\u003e\u003cb\u003earch\u003c/b\u003e\u003c/td\u003e\u003ctd\u003eCPU architecture\u003c/td\u003e\u003ctd\u003earm, x86\u003c/td\u003e\u003c/tr\u003e\n    \u003ctr\u003e\u003ctd\u003etenancy\u003c/td\u003e\u003ctd\u003eInstance tenancy\u003c/td\u003e\u003ctd\u003eShared, Dedicated, Host\u003c/td\u003e\u003c/tr\u003e\n    \u003ctr\u003e\u003ctd\u003e\u003cb\u003eregion\u003c/b\u003e\u003c/td\u003e\u003ctd\u003eAWS Region\u003c/td\u003e\u003ctd\u003eUS East (Ohio), EU (Ireland)\u003c/td\u003e\u003c/tr\u003e\n    \u003ctr\u003e\u003ctd\u003e\u003cb\u003evcpu\u003c/b\u003e\u003c/td\u003e\u003ctd\u003eNumber of virtual cores\u003c/td\u003e\u003ctd\u003e1, 2, 32\u003c/td\u003e\u003c/tr\u003e\n    \u003ctr\u003e\u003ctd\u003e\u003cb\u003ememory\u003c/b\u003e\u003c/td\u003e\u003ctd\u003eAmount of RAM\u003c/td\u003e\u003ctd\u003e0.5 GiB, 128 GiB\u003c/td\u003e\u003c/tr\u003e\n    \u003ctr\u003e\u003ctd\u003estorage\u003c/td\u003e\u003ctd\u003eStorage type\u003c/td\u003e\u003ctd\u003eEBS only, 1x60GB NVM\u003c/td\u003e\u003c/tr\u003e\n    \u003ctr\u003e\u003ctd\u003eos\u003c/td\u003e\u003ctd\u003eOperating System\u003c/td\u003e\u003ctd\u003eLinux\u003c/td\u003e\u003c/tr\u003e\n    \u003ctr\u003e\u003ctd\u003enorm\u003c/td\u003e\u003ctd\u003eNormalization scale factor (used by AWS to compare instances)\u003c/td\u003e\u003ctd\u003e0.5, 1.0, 8.0\u003c/td\u003e\u003c/tr\u003e\n    \u003ctr\u003e\u003ctd\u003espeed\u003c/td\u003e\u003ctd\u003eDeclared CPU clock speed\u003c/td\u003e\u003ctd\u003e2.5 GHz, Up to 3.2 Ghz. 0 GHz\u003c/td\u003e\u003c/tr\u003e\n    \u003ctr\u003e\u003ctd\u003e\u003cb\u003eactual\u003c/b\u003e\u003c/td\u003e\u003ctd\u003eActual CPU clock speed multiplied by baseline\u003c/td\u003e\u003ctd\u003e0.125 GHz, 2.5 Ghz\u003c/td\u003e\u003c/tr\u003e\n    \u003ctr\u003e\u003ctd\u003enetwork\u003c/td\u003e\u003ctd\u003eNetwork performance\u003c/td\u003e\u003ctd\u003eUp to 3500 MiB\u003c/td\u003e\u003c/tr\u003e\n    \u003ctr\u003e\u003ctd\u003egen\u003c/td\u003e\u003ctd\u003eIs it current generation of instances?\u003c/td\u003e\u003ctd\u003eYes, No\u003c/td\u003e\u003c/tr\u003e\n    \u003ctr\u003e\u003ctd\u003ecur\u003c/td\u003e\u003ctd\u003ePrice currency\u003c/td\u003e\u003ctd\u003eUSD, CNY\u003c/td\u003e\u003c/tr\u003e\n    \u003ctr\u003e\u003ctd\u003e\u003cb\u003ehourly\u003c/b\u003e\u003c/td\u003e\u003ctd\u003eHourly price\u003c/td\u003e\u003ctd\u003e0.0255\u003c/td\u003e\u003c/tr\u003e\n    \u003ctr\u003e\u003ctd\u003e\u003cb\u003emontly\u003c/b\u003e\u003c/td\u003e\u003ctd\u003eMonthly price (hourly * 24 * 30)\u003c/td\u003e\u003ctd\u003e3.844\u003c/td\u003e\u003c/tr\u003e\n    \u003ctr\u003e\u003ctd\u003estarting\u003c/td\u003e\u003ctd\u003eDate from which Amazon offers this price\u003c/td\u003e\u003ctd\u003e2021-09-01T00:00:00Z\u003c/td\u003e\u003c/tr\u003e\n\n\u003c/table\u003e\n\n\u003ca id=\"queries\"\u003e\u003c/a\u003e\nThe built database can be opened in any SQL IDE, for example, DBeaver (open source SQL editor) or in any other way.\nYou can then run queries in it.\n\n**Show cheapest x86-64 virtual machines**:\n\n```sql\nSELECT * FROM prices WHERE arch = 'x86'\n ORDER BY monthly;\n```\n\n**Show cheapest ARM machines in Ireland**:\n\n```sql\nSELECT * FROM prices\n WHERE arch = 'arm' AND region = \"EU (Ireland)\"\n ORDER BY monthly;\n```\n\n**Sort all machines alpabetically by their family, type and power**:\n\n```sql\nSELECT * FROM prices\n ORDER BY family, type, norm;\n```\n\n\u003ca id=\"limitations\"\u003e\u003c/a\u003e\n\n## Limitations\n\nCurrently, downloaded prices are limited to instances with:\n\n* \"Shared\" tenancy\n* \"Linux\" operating system\n* Support for VPC networking\n* Only \"On Demand\" pricing, no reserved instances or saving plans\n* \"Used\" capacity reservation\n\nAll these are default settings for EC2 instances when you check prices for them on AWS pricng website.\n\n\u003ca id=\"installation\"\u003e\u003c/a\u003e\n\n## Installation\n\nThis program is written in Python and can be installed via `pip`.\n\n```shell\npip install aws-ec2-pricing\n```\n\n## Build it and run it yourself\n\n### Set up via pip and virtual environemnt\n\n* Create a virtual environment\n\n  ```shell\n  python3 -m venv .venv\n  source ./.venv/bin/activate\n  ```\n\n* Install requirements into it\n\n  ```shell\n  pip install -r requirements.txt\n  ```\n\n* Run the program\n\n  ```shell\n  python3 ec2pricing/__init__.py download\n  ```\n\n### Set up via poetry\n\n* Tell poetry which version of python available in your system to use\n\n  ```shell\n  poetry env use 3.9.7\n  ```\n\n* Install dependencies and create virtual environment\n\n  ```shell\n  poetry install\n  ```\n\n* Run program\n\n  ```shell\n  poetry run ec2pricing download\n  ```\n\n\u003ca id=\"future\"\u003e\u003c/a\u003e\n\n## Feature plans\n\n* [ ] Static website that displays the table along with the filters\n* [ ] Add search filters as key-value pairs for initial price download\n* [ ] Search for instances other than shared or Linux based\n* [ ] Support saving plans, reserved instances, free tier\n\n## Copyright \u0026 License\n\n* This program is distributed under Apache 2 License.\n* All AWS and Amazon related trademarks or symbols are not mine.\n* Prices obtained through this program are not an offer and should not be treated as official.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvduseev%2Faws-ec2-pricing","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvduseev%2Faws-ec2-pricing","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvduseev%2Faws-ec2-pricing/lists"}