@@ -100,6 +100,22 @@ The driver checks for your credentials in the following sources in order:
100100
101101 Omit the line containing ``AWS_SESSION_TOKEN`` if you don't need an AWS
102102 session token for that role.
103+
104+ AWS recommends using regional AWS STS endpoints instead of global
105+ endpoints to reduce latency, build-in redundancy, and increase session token validity.
106+ To set the AWS region, set `AWS_REGION <https://docs.aws.amazon.com/sdkref/latest/guide/feature-region.html>`__
107+ and `AWS_STS_REGIONAL_ENDPOINTS <https://docs.aws.amazon.com/sdkref/latest/guide/feature-sts-regionalized-endpoints.html>`__
108+ as environment variables, as shown in the following example:
109+
110+ .. code-block:: bash
111+
112+ export AWS_STS_REGIONAL_ENDPOINTS=regional // Enables regional endpoints
113+ export AWS_REGION=us-east-1 // Sets your AWS region
114+
115+ If both these environment variables aren't set, the default region is
116+ ``us-east-1``. For a list of available AWS regions, see the
117+ `Regional Endpoints <https://docs.aws.amazon.com/general/latest/gr/rande.html#regional-endpoints>`__
118+ section of the AWS Service Endpoints reference in the AWS documentation.
103119
104120 After you've set the preceding environment variables, specify the ``MONGODB-AWS``
105121 authentication mechanism in your connection string as shown in the following example:
@@ -131,29 +147,7 @@ The driver checks for your credentials in the following sources in order:
131147
132148 export AWS_WEB_IDENTITY_TOKEN_FILE=<absolute path to file containing your OIDC token>
133149
134- AWS recommends using regional AWS STS endpoints instead of global
135- endpoints to reduce latency, build-in redundancy, and increase session token validity.
136- To set the AWS region, set `AWS_REGION <https://docs.aws.amazon.com/sdkref/latest/guide/feature-region.html>`__
137- and `AWS_STS_REGIONAL_ENDPOINTS <https://docs.aws.amazon.com/sdkref/latest/guide/feature-sts-regionalized-endpoints.html>`__
138- as environment variables, as shown in the following example:
139-
140- .. code-block:: bash
141-
142- export AWS_STS_REGIONAL_ENDPOINTS=regional // Enables regional endpoints
143- export AWS_REGION=us-east-1 // Sets your AWS region
144-
145- If both these environment variables aren't set, the default region is
146- ``us-east-1``. For a list of available AWS regions, see the
147- `Regional Endpoints <https://docs.aws.amazon.com/general/latest/gr/rande.html#regional-endpoints>`__
148- section of the AWS Service Endpoints reference in the AWS documentation.
149-
150- .. warning:: Consult your SDK's Documentation for Setting an AWS Region
151-
152- You cannot set your AWS region with environment variables for all SDKs,
153- as in the above example. See your SDK's specific documentation for
154- configuring an AWS region.
155-
156- After you've set the preceding environment variables, specify the ``MONGODB-AWS``
150+ After you've set the preceding environment variable, specify the ``MONGODB-AWS``
157151 authentication mechanism in your connection string as shown in the following example:
158152
159153 .. literalinclude:: /code-snippets/authentication/aws-env-variable.js
0 commit comments