@@ -229,7 +229,29 @@ The driver checks for your credentials in the following sources in order:
229
229
230
230
export AWS_WEB_IDENTITY_TOKEN_FILE=<absolute path to file containing your OIDC token>
231
231
232
- After you've set the preceding environment variable, specify the ``MONGODB-AWS``
232
+ AWS recommends using regional AWS STS endpoints instead of global
233
+ endpoints to reduce latency, build-in redundancy, and increase session token validity.
234
+ To set the AWS region, set `AWS_REGION <https://docs.aws.amazon.com/sdkref/latest/guide/feature-region.html>`__
235
+ and `AWS_STS_REGIONAL_ENDPOINTS <https://docs.aws.amazon.com/sdkref/latest/guide/feature-sts-regionalized-endpoints.html>`__
236
+ as environment variables, as shown in the following example:
237
+
238
+ .. code-block:: bash
239
+
240
+ export AWS_STS_REGIONAL_ENDPOINTS=regional // Enables regional endpoints
241
+ export AWS_REGION=us-east-1 // Sets your AWS region
242
+
243
+ If both these environment variables aren't set, the default region is
244
+ ``us-east-1``. For a list of available AWS regions, see the
245
+ `Regional Endpoints <https://docs.aws.amazon.com/general/latest/gr/rande.html#regional-endpoints>`__
246
+ section of the AWS Service Endpoints reference in the AWS documentation.
247
+
248
+ .. warning:: Consult your SDK's Documentation for Setting an AWS Region
249
+
250
+ You cannot set your AWS region with environment variables for all SDKs,
251
+ as in the above example. See your SDK's specific documentation for
252
+ configuring an AWS region.
253
+
254
+ After you've set the preceding environment variables, specify the ``MONGODB-AWS``
233
255
authentication mechanism in your connection string as shown in the following example:
234
256
235
257
.. literalinclude:: /code-snippets/authentication/aws-env-variable.js
0 commit comments