{"id":20581828,"url":"https://github.com/paddlehq/python-aws-ssm","last_synced_at":"2025-04-14T20:04:57.450Z","repository":{"id":53718569,"uuid":"202714859","full_name":"PaddleHQ/python-aws-ssm","owner":"PaddleHQ","description":"Python package that interfaces with AWS System Manager","archived":false,"fork":false,"pushed_at":"2024-04-19T12:28:34.000Z","size":68,"stargazers_count":17,"open_issues_count":1,"forks_count":1,"subscribers_count":38,"default_branch":"master","last_synced_at":"2024-04-20T12:30:06.112Z","etag":null,"topics":["aws-ssm","parameter-store","python","ssm"],"latest_commit_sha":null,"homepage":null,"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/PaddleHQ.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,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2019-08-16T11:20:19.000Z","updated_at":"2023-12-14T08:40:21.000Z","dependencies_parsed_at":"2024-04-19T12:26:54.072Z","dependency_job_id":"9105c142-bd58-4b48-9349-8b8244ca8e32","html_url":"https://github.com/PaddleHQ/python-aws-ssm","commit_stats":{"total_commits":22,"total_committers":4,"mean_commits":5.5,"dds":"0.40909090909090906","last_synced_commit":"6ec3e61fec8d38f6a23cbc9ebfd0f8189510185d"},"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PaddleHQ%2Fpython-aws-ssm","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PaddleHQ%2Fpython-aws-ssm/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PaddleHQ%2Fpython-aws-ssm/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PaddleHQ%2Fpython-aws-ssm/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/PaddleHQ","download_url":"https://codeload.github.com/PaddleHQ/python-aws-ssm/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":224884615,"owners_count":17386121,"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-ssm","parameter-store","python","ssm"],"created_at":"2024-11-16T06:31:33.460Z","updated_at":"2024-11-16T06:32:04.564Z","avatar_url":"https://github.com/PaddleHQ.png","language":"Python","readme":"[![Build Status](https://travis-ci.com/PaddleHQ/python-aws-ssm.svg?branch=master)](https://travis-ci.com/PaddleHQ/python-aws-ssm)\n[![codecov](https://codecov.io/gh/PaddleHQ/python-aws-ssm/branch/master/graph/badge.svg)](https://codecov.io/gh/PaddleHQ/python-aws-ssm)\n[![license](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n[![codestyle](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/ambv/black)\n\n# python-aws-ssm\nPython package that interfaces with [AWS System Manager](https://www.amazonaws.cn/en/systems-manager/).\n\n## Why to use python-aws-ssm and not the boto3 SSM client?\nThis package is wrapping boto3 SSM client and hides the complexity dealing with the not so Python friendly AWS SDK.\nPerfect use case for this package is when secure parameters for an application are stored to\n[AWS Parameter Store](https://docs.aws.amazon.com/systems-manager/latest/userguide/systems-manager-parameter-store.html)\nusing a path hierarchy. During application startup you can use this package to fetch them and use them in your application.\n\n## Warning\n\nThe SSM service is rate-limited by default. We strongly suggest using\nretrieving SSM keys by path, e.g. via `ParameterStore.get_parameters_by_path()`.\nThis requires grouping keys by a useful path but reduces the chance of\nyour own services being rate-limited in turn.\n\n## Install\n```bash\npip install python-aws-ssm\n```\n\n## Examples\n\n#### Basic Usage\n\n```python\nfrom python_aws_ssm.parameters import ParameterStore\n\n# Assuming you have the parameters in the following format:\n# my-service/dev/param-1  -\u003e with value `a`\n# my-service/dev/param-2  -\u003e with value `b`\nparameter_store = ParameterStore()\n# Requesting the base path\nparameters = parameter_store.get_parameters_by_path(\"/my-service/dev/\")\n# And getting a specific value\nvalue = parameters.get(\"param-1\")\n# value should be `a`\n```\n\n#### Required parameters on path\n\nRequesting parameters by path is efficient but comes with an additional\nburden of validation: clients typically expect a number of keys to be\npresent, e.g. the path `/service/foo/db/` might be used to retrieve the\ndatabase credentials including the host name at `/service/foo/db/hostname`.\nThe onus of verifying that this key is present is by default on the client.\n\nTo assert the presence of these keys automatically, pass a set of required\nparameters via the `parameters` keyword argument:\n\n```python\nfrom python_aws_ssm.parameters import ParameterStore, MissingParameterError\n\n# Assuming you have the following keys:\n#  * /service/foo/db/hostname\n#  * /service/foo/db/username\n#  * /service/foo/db/password\n#  * /service/foo/db/port\n#  * /service/foo/db/description\nparameter_store = ParameterStore()\n# Requesting the base path but asserting presence of required parameters\ntry:\n    parameters = parameter_store.get_parameters_by_path(\n            \"/service/foo/db/\",\n            required_parameters={\"hostname\", \"username\", \"password\", \"port\"}\n        )\nexcept MissingParameterError as e:\n    # Report on the missing parameters.\n    print(e.msg)\nelse:\n    # Use the parameters, knowing that they exist.\n    print(parameters['hostname'])  # guaranteed to exist.\n```\n\n#### Recursive and nested options\n\n```python\nfrom python_aws_ssm.parameters import ParameterStore\n\n# Assuming you have the parameters in the following format:\n# my-service/dev/param-1  -\u003e with value `a`\n# my-service/dev/param-2  -\u003e with value `b`\nparameter_store = ParameterStore()\n# Requesting the base path\nparameters = parameter_store.get_parameters_by_path(\n    \"/my-service/\", recursive=True, nested=True\n)\n# And getting a specific value\ndev_parameters = parameters.get(\"dev\")\n# value should be {\"param-1\": \"a\", \"param-2\": \"b\"}\n```\n\n#### Get parameters by name\n\n```python\nfrom python_aws_ssm.parameters import ParameterStore\n\n# Assuming you have the parameters in the following format:\n# my-service/dev/param-1  -\u003e with value `a`\n# common/dev/param-2  -\u003e with value `b`\nparameter_store = ParameterStore()\n# Requesting the base path\nparameters = parameter_store.get_parameters(\n    [\"/my-service/dev/param-1\", \"/common/dev/param-2\"]\n)\n# And getting a specific value\ndev_parameters = parameters.get(\"/common/dev/param-2\")\n# value should be `b`\n```\n\n#### With custom client\n\n```python\nfrom python_aws_ssm.parameters import ParameterStore\nimport boto3\n\n# Initialise an SSM client to specify the source of the credentials.\n# e.g. locally a profile would be more likely; an AWS Lambda would most\n# likely not override the credentials source.\nssm_client = boto3.Session(profile_name='dev').client('ssm')\nparameter_store = ParameterStore(ssm_client)\n\nparameters = parameter_store.get_parameters([\"/service/path/\"])\n```\n\n## Development\n\nIf you are missing any features or have found a bug, please open a PR or a new Github issue.\n\n\n#### Setup\nThis project uses Poetry to manage the dependencies and the virtual environment.\nFollow the instructions from Poetry website (https://poetry.eustace.io/docs/#installation) to configure your local environment.\n\nAfter completing the Poetry setup, the virtual environment can be created running:\n```shell\nmake setup\n```\n\n#### Tests\nTests are run by Pytest\n```shell\nmake test\n```\n\n#### Code style\n- Mypy is used for type annotations (https://github.com/python/mypy)\n- Black formatter (https://github.com/psf/black) is used to keep the coding style consistent.\n- Isort (https://github.com/timothycrosley/isort) is used to sort the imports.\nTo format the codebase just run:\n```shell\nmake format\n```\nand to check it before pushing:\n```shell\nmake lint\n```\n\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpaddlehq%2Fpython-aws-ssm","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpaddlehq%2Fpython-aws-ssm","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpaddlehq%2Fpython-aws-ssm/lists"}