You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: source/auth/auth.rst
+14-4Lines changed: 14 additions & 4 deletions
Original file line number
Diff line number
Diff line change
@@ -898,10 +898,18 @@ mechanism_properties
898
898
899
899
Obtaining Credentials
900
900
`````````````````````
901
-
Drivers will need AWS IAM credentials (an access key and a secret access key) to complete the steps in the `Signature Version 4 Signing Process
901
+
Drivers will need AWS IAM credentials (an access key, a secret access key and optionally a session token) to complete the steps in the `Signature Version 4 Signing Process
902
902
<https://docs.aws.amazon.com/general/latest/gr/signature-version-4.html?shortFooter=true>`_. If a username and password are provided drivers
903
-
MUST use these for the AWS IAM access key and AWS IAM secret key, respectively. If a username is provided without a password (or vice-versa) drivers
904
-
MUST raise an error. An example URI for authentication with MONGODB-AWS using AWS IAM credentials is as follows:
903
+
MUST use these for the AWS IAM access key and AWS IAM secret key, respectively. If, additionally, a session token is provided Drivers MUST use it as well. If a username is provided without a password (or vice-versa) or if *only* a session token is provided Drivers MUST raise an error. In other words, regardless of how Drivers obtain credentials the only valid combination of credentials is an access key ID and a secret access key or an access key ID, a secret access key and a session token.
904
+
905
+
The order in which Drivers MUST search for credentials is:
906
+
907
+
#. Credentials passed through the URI
908
+
#. Environment variables
909
+
#. ECS endpoint if and only if ``AWS_CONTAINER_CREDENTIALS_RELATIVE_URI`` is set.
910
+
#. EC2 endpoint
911
+
912
+
An example URI for authentication with MONGODB-AWS using AWS IAM credentials passed through the URI is as follows:
905
913
906
914
.. code:: javascript
907
915
@@ -914,7 +922,9 @@ request. If so, then in addition to a username and password, users MAY also prov
If a username and password are not provided, drivers MUST query a link-local AWS address for temporary credentials.
925
+
AWS Lambda runtimes set several `environment variables <https://docs.aws.amazon.com/lambda/latest/dg/configuration-envvars.html#configuration-envvars-runtime>`_ during initialization. To support AWS Lambda runtimes Drivers MUST check a subset of these variables, i.e., ``AWS_ACCESS_KEY_ID``, ``AWS_SECRET_ACCESS_KEY``, and ``AWS_SESSION_TOKEN``, for the access key ID, secret access key and session token, respectively if AWS credentials are not explicitly provided in the URI. The ``AWS_SESSION_TOKEN`` may or may not be set. However, if ``AWS_SESSION_TOKEN`` is set Drivers MUST use its value as the session token.
926
+
927
+
If a username and password are not provided and the aforementioned enviornment variables are not set, drivers MUST query a link-local AWS address for temporary credentials.
918
928
If temporary credentials cannot be obtained then drivers MUST fail authentication and raise an error. Drivers SHOULD
919
929
enforce a 10 second read timeout while waiting for incoming content from both the ECS and EC2 endpoints. If the
920
930
environment variable ``AWS_CONTAINER_CREDENTIALS_RELATIVE_URI`` is set then drivers MUST assume that it was set by an
0 commit comments