Skip to content

Commit 532190c

Browse files
DOCSP-32752 Support for setting AWS region (#958) (#997)
* DOCSP-32752 Suppor for setting AWS region * edits * merge * another merge attempt * edit * edit on title * RM review * update links * default region * tech review note * change wanring msg * wording changed * change link (cherry picked from commit 65f4f5c) Co-authored-by: lindseymoore <[email protected]>
1 parent 21d3894 commit 532190c

File tree

1 file changed

+23
-1
lines changed

1 file changed

+23
-1
lines changed

source/fundamentals/authentication/mechanisms.txt

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,29 @@ The driver checks for your credentials in the following sources in order:
228228

229229
export AWS_WEB_IDENTITY_TOKEN_FILE=<absolute path to file containing your OIDC token>
230230

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``
232254
authentication mechanism in your connection string as shown in the following example:
233255

234256
.. literalinclude:: /code-snippets/authentication/aws-env-variable.js

0 commit comments

Comments
 (0)