Parameter Store
When working with ParameterStoreBaseSettings, you can work with parameters living in the same account and region, or with multiple accounts / regions.
Simplest way
The simplest way you can work with ParameterStoreBaseSettings is to leaving it all to boto3 and create your fields with the same name as your parameters:
In this case, pydantic-settings-aws will leave to boto3 to try to identify how he can connect to AWS, and then will look for the parameters with name mongodb_host and mongodb_db_name.
Structured exceptions
pydantic-settings-aws wraps errors into its own exception hierarchy so you can catch them precisely:
ParameterNotFoundError— the parameter does not exist in Parameter StoreAWSClientError— a boto3 session or client could not be createdAWSSettingsConfigError— the settings configuration is invalid or missing required fields
All of these inherit from PydanticSettingsAWSError, so you can catch them at any level.
Unrecognised boto3 / botocore errors are re-raised as-is.
Specifying the name of the parameter
For almost all cases, your parameter's name will be different from your field name.
Multiple accounts and regions
If you need to work with multiple accounts or regions, you can use Annotated and specify a per-field client: