{ "info": { "author": "Marco Pracucci", "author_email": "marco@pracucci.com", "bugtrack_url": null, "classifiers": [], "description": "# AWS Cloud (un)Map\n\nExternal controller to remove terminated EC2 instances from AWS Cloud Map service.\n\n\n## How it works\n\nThis application scans - at a regular interval - the instances registered to a Cloud Map service and match them with the EC2 instances running in 1+ region: it will then deregister any instance registered in the service which doesn't match a running EC2 instance.\n\nRequisites:\n- The instance must be registered in the Cloud Map service with Cloud Map instance id equal to the EC2 instance id\n- The instance must be registered in the Cloud Map service with `AWS_INSTANCE_IPV4` attribute (can be the private or public IP address)\n\nHow the matching is done:\n- A registered instance is considered valid if **both** the instance id and the `AWS_INSTANCE_IPV4` address match a running EC2 instance\n- A registered instance is skipped (left untouched) if registered without `AWS_INSTANCE_IPV4` attribute\n\nSafety countermeasures:\n- The application logs a warning and do **not** deregister the unmatching instances, in case that would leave the service without registered instance\n- The application handles graceful shutdown on `SIGINT` and `SIGTERM`. If such signals are received during a reconciling, it would complete the on-going reconcile before exiting\n\n\n## How to run it\n\nYou have two options to run it:\n\n1. Manually install and run the [`aws-cloud-unmap` Python package](https://pypi.org/project/aws-cloud-unmap/)\n ```\n pip3 install aws-cloud-unmap\n\n aws-cloud-unmap --service-id srv-12345 --service-region us-east-1 --instances-region us-east-1\n ```\n\n2. Use the [Docker image available on Docker hub](https://hub.docker.com/r/spreaker/aws-cloud-unmap/)\n ```\n docker run --env AWS_ACCESS_KEY_ID=\"id\" --env AWS_SECRET_ACCESS_KEY=\"secret\" spreaker/aws-cloud-unmap --service-id srv-12345 --service-region us-east-1 --instances-region us-east-1\n ```\n\n\nThe cli supports the following arguments:\n\n| Argument | Required | Description |\n| ---------------------------------------- | -------- | ----------- |\n| `--service-id ID` | yes | AWS CloudMap service ID |\n| `--service-region REGION` | yes | AWS CloudMap service region |\n| `--instances-region REGION [REGION ...]` | yes | AWS regions where EC2 instances should be checked |\n| `--frequency N` | | How frequently the service should be reconciled (in seconds). Defaults to `300` sec |\n| `--single-run` | | Run a single reconcile and then exit |\n| `--enable-prometheus` | | Enable the Prometheus exporter. Disabled by default |\n| `--prometheus-host` | | The host at which the Prometheus exporter should listen to. Defaults to `127.0.0.1` |\n| `--prometheus-port` | | The port at which the Prometheus exporter should listen to. Defaults to `9100` |\n| `--log-level LOG_LEVEL` | | Minimum log level. Accepted values are: `DEBUG`, `INFO`, `WARNING`, `ERROR`, `CRITICAL`. Defaults to `INFO` |\n\n\n## Exported metrics\n\nThe application features an integrated Prometheus exporter. The following metrics are exported:\n\n| Metric name | Labels | Description |\n| ---------------------------------------------------------- | ------------ | ----------- |\n| `aws_cloud_unmap_up` | `service_id` | Always `1`: can be used to check if it's running |\n| `aws_cloud_unmap_last_reconcile_success_timestamp_seconds` | `service_id` | The timestamp (in seconds) of the last successful reconciliation |\n\n\n## Required IAM privileges\n\nIn order to successfully run, this application requires the following IAM privileges:\n\n```\n{\n \"Version\": \"2012-10-17\",\n \"Statement\": [\n {\n \"Sid\": \"DescribeEC2Instances\",\n \"Effect\": \"Allow\",\n \"Action\": [ \"ec2:DescribeInstances\" ],\n \"Resource\": \"*\"\n },{\n \"Sid\": \"ListAndDeregisterServiceInstances\",\n \"Effect\": \"Allow\",\n \"Action\": [\n \"servicediscovery:ListInstances\",\n \"servicediscovery:DeregisterInstance\",\n \"route53:GetHealthCheck\",\n \"route53:DeleteHealthCheck\",\n \"route53:UpdateHealthCheck\"\n ],\n \"Resource\": \"*\"\n },{\n \"Sid\": \"UpdateDnsWhileDeregisteringServiceInstances\",\n \"Effect\": \"Allow\",\n \"Action\": [ \"route53:ChangeResourceRecordSets\" ],\n \"Resource\": [\n \"ARN-OF-YOUR-ROUTE53-HOSTEDZONE\"\n ]\n }\n ]\n}\n```\n\n\n## Development\n\nRun the development environment:\n\n```\ndocker-compose build dev && docker-compose run --rm dev\n```\n\nRun tests in the dev environment:\n\n```\npython3 -m unittest\n```\n\n\n## License\n\nThis software is released under the [MIT license](LICENSE.txt).", "description_content_type": "text/markdown", "docs_url": null, "download_url": "https://github.com/spreaker/aws-cloud-unmap/archive/1.1.1.tar.gz", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/spreaker/aws-cloud-unmap", "keywords": "aws,cloud map", "license": "", "maintainer": "", "maintainer_email": "", "name": "aws-cloud-unmap", "package_url": "https://pypi.org/project/aws-cloud-unmap/", "platform": "", "project_url": "https://pypi.org/project/aws-cloud-unmap/", "project_urls": { "Download": "https://github.com/spreaker/aws-cloud-unmap/archive/1.1.1.tar.gz", "Homepage": "https://github.com/spreaker/aws-cloud-unmap" }, "release_url": "https://pypi.org/project/aws-cloud-unmap/1.1.1/", "requires_dist": null, "requires_python": ">= 3", "summary": "Remove terminated EC2 instances from AWS CloudMap service", "version": "1.1.1" }, "last_serial": 5096467, "releases": { "1.0.3": [ { "comment_text": "", "digests": { "md5": "6782a54e7d112b8dea4878f4037f3d0e", "sha256": "86428f2584c72fc3b0a70facafc1c942b80d8913724e09ef33943e6245f8d3fa" }, "downloads": -1, "filename": "aws-cloud-unmap-1.0.3.tar.gz", "has_sig": false, "md5_digest": "6782a54e7d112b8dea4878f4037f3d0e", "packagetype": "sdist", "python_version": "source", "requires_python": ">= 3", "size": 4919, "upload_time": "2019-03-29T14:36:45", "url": "https://files.pythonhosted.org/packages/32/66/3c8e714ffc23d0ee50f2f64fdefc86e07c4c3140836a3d58d94ccc820928/aws-cloud-unmap-1.0.3.tar.gz" } ], "1.0.4": [ { "comment_text": "", "digests": { "md5": "ad6664203c2acc5b7c24ceb5320e150d", "sha256": "12d21ff7a596100ad58ce0eadb02eddd04d9da71021c23ef164c662ef9b81fe2" }, "downloads": -1, "filename": "aws-cloud-unmap-1.0.4.tar.gz", "has_sig": false, "md5_digest": "ad6664203c2acc5b7c24ceb5320e150d", "packagetype": "sdist", "python_version": "source", "requires_python": ">= 3", "size": 4996, "upload_time": "2019-03-29T16:45:55", "url": "https://files.pythonhosted.org/packages/41/cb/8fde2a1a366d3782ed87179d4957966ed043267230e9e1713ebed573c8f1/aws-cloud-unmap-1.0.4.tar.gz" } ], "1.1.0": [ { "comment_text": "", "digests": { "md5": "ce31115ef1a949bed1ecfed8f25fcf38", "sha256": "1e88900551f6448c74b1ca5cd17b9e304b66d949b7df4844a026879545ec4866" }, "downloads": -1, "filename": "aws-cloud-unmap-1.1.0.tar.gz", "has_sig": false, "md5_digest": "ce31115ef1a949bed1ecfed8f25fcf38", "packagetype": "sdist", "python_version": "source", "requires_python": ">= 3", "size": 5630, "upload_time": "2019-04-03T10:57:07", "url": "https://files.pythonhosted.org/packages/e9/b1/25a40fd517a410b76d99b3125a5ddefedcf397fbb28e1130866c736cbf1f/aws-cloud-unmap-1.1.0.tar.gz" } ], "1.1.1": [ { "comment_text": "", "digests": { "md5": "d71027c7ab5bdfbde131fae33cbbd226", "sha256": "694de05c24608cf71a4da365da4ef161904a381b52b9e75b1d93f842184950e6" }, "downloads": -1, "filename": "aws-cloud-unmap-1.1.1.tar.gz", "has_sig": false, "md5_digest": "d71027c7ab5bdfbde131fae33cbbd226", "packagetype": "sdist", "python_version": "source", "requires_python": ">= 3", "size": 6099, "upload_time": "2019-04-04T10:37:35", "url": "https://files.pythonhosted.org/packages/9f/1d/c3d27bcbaf0c02184e8be97c3fadc85d67f3f72779d198b481af676bab3e/aws-cloud-unmap-1.1.1.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "d71027c7ab5bdfbde131fae33cbbd226", "sha256": "694de05c24608cf71a4da365da4ef161904a381b52b9e75b1d93f842184950e6" }, "downloads": -1, "filename": "aws-cloud-unmap-1.1.1.tar.gz", "has_sig": false, "md5_digest": "d71027c7ab5bdfbde131fae33cbbd226", "packagetype": "sdist", "python_version": "source", "requires_python": ">= 3", "size": 6099, "upload_time": "2019-04-04T10:37:35", "url": "https://files.pythonhosted.org/packages/9f/1d/c3d27bcbaf0c02184e8be97c3fadc85d67f3f72779d198b481af676bab3e/aws-cloud-unmap-1.1.1.tar.gz" } ] }