@@ -957,7 +957,9 @@ Examples are provided below.
957957
958958 - AWS_SESSION_TOKEN
959959
960- Drivers MUST allow the user to specify an AWS session token for authentication with temporary credentials.
960+ Drivers MAY allow an AWS session token for authentication with temporary credentials to exist in their API,
961+ internally, but MUST raise an error if the user provided it explicitly via the URI or client options. This property
962+ MUST NOT exist in the public API.
961963
962964 - AWS_CREDENTIAL_PROVIDER
963965
@@ -1011,11 +1013,10 @@ Drivers MAY expose API for default providers for the following scenarios when ap
10111013
10121014The order in which Drivers MUST search for credentials is:
10131015
1014- 1. The URI
1015- 2. A custom AWS credential provider if the driver supports it.
1016- 3. Environment variables
1017- 4. Using `AssumeRoleWithWebIdentity` if `AWS_WEB_IDENTITY_TOKEN_FILE` and `AWS_ROLE_ARN` are set.
1018- 5. The ECS endpoint if `AWS_CONTAINER_CREDENTIALS_RELATIVE_URI` is set. Otherwise, the EC2 endpoint.
1016+ 1. A custom AWS credential provider if the driver supports it.
1017+ 2. Environment variables
1018+ 3. Using `AssumeRoleWithWebIdentity` if `AWS_WEB_IDENTITY_TOKEN_FILE` and `AWS_ROLE_ARN` are set.
1019+ 4. The ECS endpoint if `AWS_CONTAINER_CREDENTIALS_RELATIVE_URI` is set. Otherwise, the EC2 endpoint.
10191020
10201021> [!NOTE]
10211022> See *Should drivers support accessing Amazon EC2 instance metadata in Amazon ECS* in [Q & A](#q-and-a)
@@ -1025,32 +1026,16 @@ The order in which Drivers MUST search for credentials is:
10251026> description of `AssumeRole` below, which is distinct from `AssumeRoleWithWebIdentity` requests that are meant to be
10261027> handled directly by the driver.
10271028
1028- ##### URI
1029-
1030- An example URI for authentication with MONGODB-AWS using AWS IAM credentials passed through the URI is as follows:
1031-
1032- ```javascript
1033- "mongodb://<access_key>:<secret_key>@mongodb.example.com/?authMechanism=MONGODB-AWS"
1034- ```
1035-
1036- Users MAY have obtained temporary credentials through an
1037- [AssumeRole](https://docs.aws.amazon.com/STS/latest/APIReference/API_AssumeRole.html) request. If so, then in addition
1038- to a username and password, users MAY also provide an `AWS_SESSION_TOKEN` as a `mechanism_property`.
1039-
1040- ```javascript
1041- "mongodb://<access_key>:<secret_key>@mongodb.example.com/?authMechanism=MONGODB-AWS&authMechanismProperties=AWS_SESSION_TOKEN:<security_token>"
1042- ```
1043-
10441029##### Environment variables
10451030
10461031AWS Lambda runtimes set several
10471032[environment variables](https://docs.aws.amazon.com/lambda/latest/dg/configuration-envvars.html#configuration-envvars-runtime)
10481033during initialization. To support AWS Lambda runtimes Drivers MUST check a subset of these variables, i.e.,
10491034`AWS_ACCESS_KEY_ID`, `AWS_SECRET_ACCESS_KEY`, and `AWS_SESSION_TOKEN`, for the access key ID, secret access key and
1050- session token, respectively if AWS credentials are not explicitly provided in the URI. The `AWS_SESSION_TOKEN` may or
1051- may not be set. However, if `AWS_SESSION_TOKEN` is set Drivers MUST use its value as the session token. Drivers
1052- implemented in programming languages that support altering environment variables MUST always read environment variables
1053- dynamically during authorization, to handle the case where another part the application has refreshed the credentials.
1035+ session token, respectively. The `AWS_SESSION_TOKEN` may or may not be set. However, if `AWS_SESSION_TOKEN` is set Drivers
1036+ MUST use its value as the session token. Drivers implemented in programming languages that support altering environment
1037+ variables MUST always read environment variables dynamically during authorization, to handle the case where another part the
1038+ application has refreshed the credentials.
10541039
10551040However, if environment variables are not present during initial authorization, credentials may be fetched from another
10561041source and cached. Even if the environment variables are present in subsequent authorization attempts, the driver MUST
@@ -2165,6 +2150,8 @@ practice to avoid this. (See
21652150
21662151## Changelog
21672152
2153+ - 2025-09-30: Remove credentials URI support for MONGODDB-AWS.
2154+
21682155- 2025-09-10: Update precedence of MONGODB-AWS credential fetching behaviour.
21692156
21702157- 2025-01-29: Add support for custom AWS credential providers.
0 commit comments