pydantic / pydantic-settings

Settings management using pydantic
https://docs.pydantic.dev/latest/usage/pydantic_settings/
MIT License
606 stars 61 forks source link

Add AWS SSM Parameter Store support #399

Open alukach opened 1 month ago

alukach commented 1 month ago

In #385, I added a code change to natively support retrieving configuration from the AWS Systems Manager Parameter Store. However, that was somewhat premature as support for such a feature had not yet been agreed upon.

This issue is to track support for that feature.

Background

From the product page:

AWS Systems Manager provides a centralized store to manage your configuration data, whether plain-text data such as database strings or secrets such as passwords. This allows you to separate your secrets and configuration data from your code. Parameters can be tagged and organized into hierarchies, helping you manage parameters more easily. For example, you can use the same parameter name, "db-string", with a different hierarchical path, "dev/db-string” or “prod/db-string", to store different values. Systems Manager is integrated with AWS Key Management Service (KMS), allowing you to automatically encrypt the data you store. You can also control user and resource access to parameters using AWS Identity and Access Management (IAM). Parameters can be referenced through other AWS services, such as Amazon ECS, AWS Lambda, and AWS CloudFormation.

It is similar to AWS Secrets Manager, with a few differences:

Fit within Pydantic Settings

Given that we currently support Azure Key Vault settings source (https://github.com/pydantic/pydantic-settings/pull/272) and have green-lighted support for AWS Secrets Manager (https://github.com/pydantic/pydantic-settings/issues/175#issuecomment-1750167497), I think rounding out support with AWS SSM Parameter Store seems like a reasonable addition.

Will people use it?

I maintain a project to support for AWS SSM Parameter Store for Pydantic v1 (github, pypi). At time of writing, it has 19 stars on Github and PyPi stats reports the usage as such:

Downloads last day: 56 Downloads last week: 178 Downloads last month: 653

Not tremendously popular, but it is used by projects in the wild.

evdevr commented 3 days ago

seems @ceb10n has also worked on an extension for this recently, supporting pydantic>=2.0.1: pydantic-settings-aws

blog post (with some use cases) docs github pypi

pydantic-settings-aws shows similar stats to @alukach's project:

Downloads last day: 44 Downloads last week: 496 Downloads last month: 1,168