Skip to content

Commit 1c4d639

Browse files
DOCSP-32752 Support for setting AWS region (#958) (#986)
* 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 0aabac8 commit 1c4d639

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
@@ -229,7 +229,29 @@ The driver checks for your credentials in the following sources in order:
229229

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

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

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

0 commit comments

Comments
 (0)