{ "info": { "author": "Cariad Eccleston", "author_email": "cariad@cariad.me", "bugtrack_url": null, "classifiers": [ "Development Status :: 5 - Production/Stable", "Environment :: Console", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Natural Language :: English", "Operating System :: OS Independent", "Programming Language :: Python :: 3", "Topic :: Internet :: WWW/HTTP :: Site Management" ], "description": "# py-chesney\n\n[![CircleCI](https://circleci.com/gh/cariad/py-chesney/tree/master.svg?style=svg)](https://circleci.com/gh/cariad/py-chesney/tree/master)\n\nA Python package to indicate if an AWS EC2 instance is *the one and only* appointed to perform a special task within an auto-scaling group.\n\n## Motivation\n\nLet's say you've got a fleet of EC2 instances, deployed via an auto-scaling group, all serving web content from a shared network drive.\n\nNow, let's say you want to appoint one of those EC2 instances to be *the one and only* to backup the shared content to another location.\n\nIf the launch configuration set up *every* instance to perform the backup then they could all end up tramping over each other, and there'd be a ton of wasted traffic. If you manually configured one as a special case to perform the backup, then what happens when that instance goes down?\n\n(Of course, you might decide to have a *totally separate* EC2 instance connect to the network drive to perform the backup, so that your web servers don't hold multiple responsibilities. This would be a good idea. I'm assuming that your project ain't worth that level of infrastructure, and you're happy with instances holding multiple responsibilities.)\n\n`chesney` solves this problem by ensuring it returns `true` for only *one* EC2 instance within an auto-scaling group, and `false` for all the rest. This means you can configure all of your instances to -- for example -- perform a daily check to see if they're *the one and only*, and then initiate the backup only if they are.\n\n## Installation\n\n```shell\npip install chesney\n```\n\n## Command-line usage\n\n```shell\npython -m chesney [--log-level LEVEL]\n```\n\nWill return either `true` or `false`.\n\n## Code usage\n\n```python\nimport chesney\n\nif chesney.is_appointed():\n # Do the thing\nelse:\n # Don't do the thing.\n```\n\n## Permissions\n\nYou must run `chesney` with the following permissions:\n\n- `autoscaling:DescribeAutoScalingGroups`\n- `ec2:DescribeInstances`\n\nAn IAM policy would look something like this:\n\n```yaml\nPolicyName: AllowChesney\nPolicyDocument:\n Statement:\n - Effect: Allow\n Action:\n - \"autoscaling:DescribeAutoScalingGroups\"\n - \"ec2:DescribeInstances\"\n Resource:\n - \"*\"\n```\n\n## Development\n\n### Prerequisites\n\n`chesney` requires Python 3.x.\n\n### Installing dependencies\n\n```shell\npip install -e .[dev]\n```\n\n### Running tests\n\n```shell\npython test.py\n```\n\n## Changelog\n\n### v1.0 - 2018-12-03\n\n- Initial release.\n\n\n", "description_content_type": "text/markdown", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/cariad/py-chesney", "keywords": "", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "chesney", "package_url": "https://pypi.org/project/chesney/", "platform": "", "project_url": "https://pypi.org/project/chesney/", "project_urls": { "Homepage": "https://github.com/cariad/py-chesney" }, "release_url": "https://pypi.org/project/chesney/1.0/", "requires_dist": [ "boto3 (~=1.9)", "ec2-metadata (~=1.8)", "autopep8 ; extra == 'dev'", "coverage ; extra == 'dev'", "mock ; extra == 'dev'", "pylint ; extra == 'dev'" ], "requires_python": "", "summary": "A Python package to indicate if this EC2 instance should be the one and only to perform a task within an auto-scaling group.", "version": "1.0" }, "last_serial": 4556982, "releases": { "1.0": [ { "comment_text": "", "digests": { "md5": "002e3d54b09766c8c207502305b5ce9a", "sha256": "bf0f5081236b3409b0a41900b13faedfcc9d7211b66fd9eedd79f6fbc7c2b838" }, "downloads": -1, "filename": "chesney-1.0-py3-none-any.whl", "has_sig": false, "md5_digest": "002e3d54b09766c8c207502305b5ce9a", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 6563, "upload_time": "2018-12-03T19:50:19", "url": "https://files.pythonhosted.org/packages/6f/91/b24ff7035bbcfd87931f821ea1155d9fedf497fe4132a5006bdc8dc67f42/chesney-1.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "e4816a1cb93ab1086d0892b87f435c77", "sha256": "b18e33d6d1a7d254ba6ab60d3b1063a5246fbbe4bb75b76b1f5a80db5fe68f2e" }, "downloads": -1, "filename": "chesney-1.0.tar.gz", "has_sig": false, "md5_digest": "e4816a1cb93ab1086d0892b87f435c77", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4496, "upload_time": "2018-12-03T19:50:21", "url": "https://files.pythonhosted.org/packages/b2/1e/2c1d414d1154da06e7fbd3c8d85fc28b94dc69aa5c78ab484dc80126b9a0/chesney-1.0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "002e3d54b09766c8c207502305b5ce9a", "sha256": "bf0f5081236b3409b0a41900b13faedfcc9d7211b66fd9eedd79f6fbc7c2b838" }, "downloads": -1, "filename": "chesney-1.0-py3-none-any.whl", "has_sig": false, "md5_digest": "002e3d54b09766c8c207502305b5ce9a", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 6563, "upload_time": "2018-12-03T19:50:19", "url": "https://files.pythonhosted.org/packages/6f/91/b24ff7035bbcfd87931f821ea1155d9fedf497fe4132a5006bdc8dc67f42/chesney-1.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "e4816a1cb93ab1086d0892b87f435c77", "sha256": "b18e33d6d1a7d254ba6ab60d3b1063a5246fbbe4bb75b76b1f5a80db5fe68f2e" }, "downloads": -1, "filename": "chesney-1.0.tar.gz", "has_sig": false, "md5_digest": "e4816a1cb93ab1086d0892b87f435c77", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4496, "upload_time": "2018-12-03T19:50:21", "url": "https://files.pythonhosted.org/packages/b2/1e/2c1d414d1154da06e7fbd3c8d85fc28b94dc69aa5c78ab484dc80126b9a0/chesney-1.0.tar.gz" } ] }