Skip to content

Instantly share code, notes, and snippets.

View wrgeorge1983's full-sized avatar

William George wrgeorge1983

View GitHub Profile
@DomWeldon
DomWeldon / README.md
Last active September 21, 2024 10:27
SSM + pydantic: ARNs in environment variables are queried at load time

SSM + Pydantic

Query values from SSM when deployed, by placing an SSM ARN as the environment variable

Background

I wanted to query secrets from SSM at runtime, to laod them into a pydantic.BaseSettings settings object, but still be able to pass standard values during development (and I guess, if I want, in prod).

I've done a couple of similar implementations before, but they have always felt clunky and involved altering the object after instantiation, or hard coding which values to take out of SSM.