Pydantic Settings AWS
pydantic-settings-aws extends Pydantic Settings to load configuration from AWS Secrets Manager and SSM Parameter Store directly into type-safe Pydantic models, eliminating the need for manual boto3 parsing or environment variable mapping.
✨ Why pydantic-settings-aws?
- Define your configuration once using Pydantic models
- Load secrets and parameters from AWS without manual boto3 code
- Built-in validation, parsing, and type safety
- Works with any AWS authentication method — profiles, SSO, IAM roles, access keys
- Thread-safe and compatible with free-threaded Python
⚡ Quick Start
Add your secret to AWS Secrets Manager as a JSON object:
{
"username": "admin",
"password": "s3cr3t"
}
Then create your settings class:
from pydantic_settings_aws import AWSSettingsConfigDict, SecretsManagerBaseSettings
class MySettings(SecretsManagerBaseSettings):
model_config = AWSSettingsConfigDict(
secrets_name="my/secret"
)
username: str
password: str
settings = MySettings()
print(settings.username) # "admin"
That’s it, boto3 will resolve your AWS credentials automatically using its standard configuration chain.
✅ Features
- Load settings from AWS Secrets Manager, SSM Parameter Store, or both simultaneously
- Type-safe configuration with full IDE autocomplete via
AWSSettingsConfigDict - Multi-region and multi-account support via per-field boto3 clients
- Thread-safe client cache, compatible with free-threaded Python (3.13t, 3.14t)
- Falls back to environment variables, dotenv, and secret files automatically
🔧 Requirements
| Python | Pydantic | boto3 |
|---|---|---|
| 3.10+ | v2 | v1 |
💽 Installation
pip install pydantic-settings-aws
Or with uv:
uv add pydantic-settings-aws
📦 Usage
You can provide your own boto3 client or let pydantic-settings-aws create one for you. To learn how boto3 resolves credentials, see Configuring credentials.
🔐 Secrets Manager — with boto3 client
import boto3
from pydantic_settings_aws import AWSSettingsConfigDict, SecretsManagerBaseSettings
client = boto3.client("secretsmanager")
class MySettings(SecretsManagerBaseSettings):
model_config = AWSSettingsConfigDict(
secrets_name="my/secret",
secrets_client=client
)
username: str
password: str
name: str | None = None
settings = MySettings()
Your secret content must be valid JSON with keys matching the field names:
{
"username": "admin",
"password": "admin",
"name": "John"
}
📦 SSM Parameter Store
from typing import Annotated
from pydantic_settings_aws import AWSSettingsConfigDict, ParameterStoreBaseSettings
class MySettings(ParameterStoreBaseSettings):
model_config = AWSSettingsConfigDict(aws_region="us-east-1")
# pydantic-settings-aws looks for a parameter named "db_host"
db_host: str
# explicit parameter name via Annotated
db_port: Annotated[str, "/myapp/prod/db/port"]
🙋🏾♂️ Secrets Manager — with AWS profile
from pydantic_settings_aws import AWSSettingsConfigDict, SecretsManagerBaseSettings
class MySettings(SecretsManagerBaseSettings):
model_config = AWSSettingsConfigDict(
secrets_name="my/secret",
aws_region="us-east-1",
aws_profile="dev"
)
username: str
password: str
🔑 Secrets Manager — with access key
from pydantic_settings_aws import AWSSettingsConfigDict, SecretsManagerBaseSettings
class MySettings(SecretsManagerBaseSettings):
model_config = AWSSettingsConfigDict(
secrets_name="my/secret",
aws_region="us-east-1",
aws_access_key_id="aws_access_key_id",
aws_secret_access_key="aws_secret_access_key",
aws_session_token="aws_session_token"
)
username: str
password: str
🔒 Secrets Manager — with AWS IAM Identity Center (SSO)
aws sso login --profile my-profile
from pydantic_settings_aws import AWSSettingsConfigDict, SecretsManagerBaseSettings
class MySettings(SecretsManagerBaseSettings):
model_config = AWSSettingsConfigDict(
secrets_name="my/secret"
)
username: str
password: str
👩🏼⚖️ License
This project is licensed under the terms of the MIT license.
Metadata
Release files for pydantic-settings-aws 1.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| pydantic_settings_aws-1.1.0.tar.gz | 475.5 kB | With provenance | Details for pydantic_settings_aws-1.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| pydantic_settings_aws-1.1.0-py3-none-any.whl | Python 3 | none | any | Details for pydantic_settings_aws-1.1.0-py3-none-any.whl |
Total release size: 489.2 kB
Release files / pydantic_settings_aws-1.1.0.tar.gz
| Download URL | pydantic_settings_aws-1.1.0.tar.gz |
|---|---|
| Size | 475.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c3da161e3f118b55e6e018e2f5819bae23728bb1f4138008dea4eb44c4eaa13d
|
|
BLAKE2b-256 checksum How to use checksums |
416518f2644acc3e852600bc7984c68697457c5cf7fbc142ab0e49c7aa5c0992
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Apr 5, 2026.
Transparency logRelease files / pydantic_settings_aws-1.1.0-py3-none-any.whl
| Download URL | pydantic_settings_aws-1.1.0-py3-none-any.whl |
|---|---|
| Size | 13.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
3b9682cf736d9d80d19258f81dec3582c27d24800b5cabda92552eebc1fb93eb
|
|
BLAKE2b-256 checksum How to use checksums |
1625ada5c2e2cd0005a9e9e069606e2bd8672ee7bfc81951468b41abee3cfc35
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Apr 5, 2026.
Transparency logSecurity for pydantic-settings-aws 1.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
All 2 files in this release have been uploaded with provenance metadata.
Attestation for pydantic_settings_aws-1.1.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Apr 5, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.