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