{"id":24517757,"url":"https://github.com/fstab50/spotlib","last_synced_at":"2026-04-25T22:33:27.734Z","repository":{"id":57470333,"uuid":"199207321","full_name":"fstab50/spotlib","owner":"fstab50","description":"Python 3 library for retrieval and processing of Amazon EC2 Spot Price history data","archived":false,"fork":false,"pushed_at":"2022-07-23T21:03:43.000Z","size":3545,"stargazers_count":0,"open_issues_count":2,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-08-18T01:17:05.680Z","etag":null,"topics":["amazon-web-services","aws","ec2-spot","ec2-spot-instances","iam-permissions","price-data","python3","retrieve-data","spotlib-library"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/fstab50.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":"2019-07-27T19:48:24.000Z","updated_at":"2022-07-23T20:56:48.000Z","dependencies_parsed_at":"2022-09-19T10:01:47.833Z","dependency_job_id":null,"html_url":"https://github.com/fstab50/spotlib","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/fstab50/spotlib","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fstab50%2Fspotlib","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fstab50%2Fspotlib/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fstab50%2Fspotlib/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fstab50%2Fspotlib/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fstab50","download_url":"https://codeload.github.com/fstab50/spotlib/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fstab50%2Fspotlib/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32279655,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-25T18:29:39.964Z","status":"ssl_error","status_checked_at":"2026-04-25T18:29:32.149Z","response_time":59,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["amazon-web-services","aws","ec2-spot","ec2-spot-instances","iam-permissions","price-data","python3","retrieve-data","spotlib-library"],"created_at":"2025-01-22T01:35:05.202Z","updated_at":"2026-04-25T22:33:27.699Z","avatar_url":"https://github.com/fstab50.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003ca name=\"top\"\u003e\u003c/a\u003e\n* * *\n# spotlib\n* * *\n\n## Summary\n\nPython 3 library for retrieving historical spot prices from [Amazon EC2](http://aws.amazon.com/ec2) Service.\n\nInternally, **spotlib** utilises a paged generator architecture to achieve maximum performance with non-blocking state transition.\n\nAlthough **spotlib** was designed for maximum flexibility as a library, **spotlib** also includes a cli helper application, [spotcli](#spotcli), a cli binary which can be used directly for retrieving spot price data simple use cases.\n\n**Version**: 0.2.10\n\n* * *\n\n## Contents\n\n* [**Dependencies**](#dependencies)\n\n* [**Installation**](#installation)\n\n* [**Use**](#use)\n    * [**Spotlib Library**](#use)\n    * [**Spotcli Helper Application**](#spotcli-help)\n        * [Options](#spotcli-help)\n        * [Data Retrieval -- 1 AWS Region](#spotcli-1region)\n        * [Data Retrieval -- Multiple AWS Regions](#spotcli-multiregion)\n\n* [**IAM Permissions**](#iam-permissions)\n\n* [**Author \u0026 Copyright**](#author--copyright)\n\n* [**License**](#license)\n\n* [**Disclaimer**](#disclaimer)\n\n--\n\n[back to the top](#top)\n\n* * *\n\n## Dependencies\n\n[spotlib](https://github.com/fstab50/spotlib) requires:\n\n* [Python 3.6+](https://docs.python.org/3/).\n\n* [Boto3](https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/index.html) Python SDK for Amazon Web Services\n\n* [Libtools](https://github.com/fstab50/libtools) General utilities library\n\n\n[back to the top](#top)\n\n* * *\n## Installation\n\n**spotlib** may be installed on Linux via [pip, python package installer](https://pypi.org/project/pip) in one of two methods:\n\nTo install **spotlib** for a single user:\n\n```\n$  pip3 install spotlib --user\n```\n\nTo install **spotlib** for all users (Linux):\n\n```\n$  sudo -H pip3 install spotlib\n```\n\n[back to the top](#top)\n\n* * *\n## Use\n* * *\n### Use / Spotlib Library\n\n**spotlib** can be used most flexibly as an importable library:\n\n1. Initial Setup:  Default endpoints for data retreival is a period of 1 day\n\n    ```python\n    \u003e\u003e\u003e from spotlib import SpotPrices, DurationEndpoints\n    \u003e\u003e\u003e sp = SpotPrices()\n    ```\n\n    ```\n    # Display datetime endpoints\n    \u003e\u003e\u003e sp.start\n\n    datetime.datetime(2019, 9, 17, 0, 0)\n\n    \u003e\u003e\u003e sp.end\n\n    datetime.datetime(2019, 9, 18, 0, 0)\n    ```\n\n2. Set custom endpoints (start \u0026 end date times, 10 days back from today):\n\n    ```python\n    \u003e\u003e\u003e start, end = sp.set_endpoints(duration=10)\n    ```\n\n3. Retrieve spot price data for the custom time period for a particular region:\n\n    ```python\n    \u003e\u003e\u003e prices = sp.generate_pricedata(regions=['eu-west-1'])\n    ```\n\n4. Examine price data returned:\n\n    ```python\n    \u003e\u003e\u003e from libtools.js import export_iterobject\n    \u003e\u003e\u003e export_iterobject(prices)\n    ```\n\n\n\u003cp\u003e\n    \u003ca href=\"http://images.awspros.world/spotlib/use-library.png\" target=\"_blank\"\u003e\u003cimg src=\"./assets/use-library.png\"\u003e\n\u003c/p\u003e\n\n--\n\n[back to the top](#top)\n\n* * *\n\u003ca name=\"spotcli-help\"\u003e\u003c/a\u003e\n### Use / Spotcli Helper Application / Options\n\nTo display the help menu for **spotcli**, the included command line helper application:\n\n```bash\n    $ spotcli --help\n```\n\n\u003cp align=\"center\"\u003e\n    \u003ca href=\"http://images.awspros.world/spotlib/help-menu.png\" target=\"_blank\"\u003e\u003cimg src=\"./assets/help-menu.png\"\u003e\n\u003c/p\u003e\n\n--\n\n[back to the top](#top)\n\n* * *\n\u003ca name=\"spotcli-1region\"\u003e\u003c/a\u003e\n### Use / Spotcli Helper Application / Data Retrieval (1 region)\n\nTo run a test of the spotlib library, retrieve spot price data and writeout to disk:\n\n```bash\n$ spotcli --duration-days 3 --region eu-west-1\n```\n\n\u003cp align=\"center\"\u003e\n    \u003ca href=\"http://images.awspros.world/spotlib/spotcli-1region.png\" target=\"_blank\"\u003e\u003cimg src=\"./assets/spotcli-1region.png\"\u003e\n\u003c/p\u003e\n\n--\n\n[back to the top](#top)\n\n* * *\n\u003ca name=\"spotcli-multiregion\"\u003e\u003c/a\u003e\n### Use / Spotcli Helper Application / Data Retrieval (multi-region)\n\nTo run a test of the spotlib library, retrieve spot price data and writeout to disk:\n\n```bash\n$ spotcli --duration-days 1 --region eu-west-1 eu-west-2 us-east-1\n```\n\n\u003cp align=\"center\"\u003e\n    \u003ca href=\"http://images.awspros.world/spotlib/spotcli-multiregion.png\" target=\"_blank\"\u003e\u003cimg src=\"./assets/spotcli-multiregion.png\"\u003e\n\u003c/p\u003e\n\n--\n\n[back to the top](#top)\n\n* * *\n## IAM Permissions\n\nEither an Identity and Access Management user or role must be used to retrieve spot price data from AWS. The following is the minimum permissions required to retrieve data:\n\n```json\n{\n    \"Version\": \"2012-10-17\",\n    \"Statement\": [\n        {\n            \"Sid\": \"VisualEditor0\",\n            \"Effect\": \"Allow\",\n            \"Action\": [\n                \"ec2:DescribeSpotPriceHistory\",\n                \"ec2:DescribeRegions\"\n            ],\n            \"Resource\": \"*\"\n        }\n    ]\n}\n```\n\nAlternatively, if more permissive (but still read-only) permissions can be tolerated, the AWS Managed Policy 'AmazonEC2ReadOnlyAccess' can be used via the following ARN:\n\n* arn:aws:iam::aws:policy/AmazonEC2ReadOnlyAccess\n\nThe permissions above for IAM are a subset of the AmazonEC2ReadOnlyAccess policy.  Either should work without problems.\n\n--\n\n[back to the top](#top)\n\n* * *\n\n## Author \u0026 Copyright\n\nAll works contained herein copyrighted via below author unless work is explicitly noted by an alternate author.\n\n* Copyright Blake Huber, All Rights Reserved.\n\n[back to the top](#top)\n\n* * *\n\n## License\n\n* Software contained in this repo is licensed under the [license agreement](./LICENSE.md).  You may display the license and copyright information by issuing the following command:\n\n```\n$ spotcli --version\n```\n\n\u003cp align=\"center\"\u003e\n    \u003ca href=\"http://images.awspros.world/spotlib/version-copyright.png\" target=\"_blank\"\u003e\u003cimg src=\"./assets/version-copyright.png\"\u003e\n\u003c/p\u003e\n\n[back to the top](#top)\n\n* * *\n\n## Disclaimer\n\n*Code is provided \"as is\". No liability is assumed by either the code's originating author nor this repo's owner for their use at AWS or any other facility. Furthermore, running function code at AWS may incur monetary charges; in some cases, charges may be substantial. Charges are the sole responsibility of the account holder executing code obtained from this library.*\n\nAdditional terms may be found in the complete [license agreement](./LICENSE.md).\n\n[back to the top](#top)\n\n* * *\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffstab50%2Fspotlib","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffstab50%2Fspotlib","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffstab50%2Fspotlib/lists"}