Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 27 additions & 19 deletions source/fundamentals/auth.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@
Authentication Mechanisms
=========================

.. default-domain:: mongodb

.. contents:: On this page
:local:
:backlinks: none
Expand Down Expand Up @@ -199,22 +197,23 @@ user.
To connect to a MongoDB instance with ``MONGODB-AWS`` authentication enabled,
specify the ``MONGODB-AWS`` authentication mechanism.

The driver checks for your credentials in the following sources in the order
they are listed:
The driver checks for your credentials in the following sources in the
order listed:

1. Connection string
#. Environment variables
#. Web identity token file
#. AWS ECS endpoint specified in the ``AWS_CONTAINER_CREDENTIALS_RELATIVE_URI``
environment variable
#. AWS EC2 endpoint. For more information, see `IAM Roles for Tasks
<https://docs.aws.amazon.com/AmazonECS/latest/developerguide/task-iam-roles.html>`_.
1. Connection string.
#. Environment variables.
#. Web identity token file.
#. AWS ECS endpoint specified in the
``AWS_CONTAINER_CREDENTIALS_RELATIVE_URI`` environment variable.
#. AWS EC2 endpoint. To learn more, see `IAM Roles for Tasks
<https://docs.aws.amazon.com/AmazonECS/latest/developerguide/task-iam-roles.html>`__
in the AWS documentation.

.. important::

The driver obtains the credentials only from the first source in which they are found.
For example, if you specify your AWS credentials in the connection string, the
driver ignores any credentials that you have specified in environment variables.
driver ignores any credentials that you specify in environment variables.

.. tabs::

Expand Down Expand Up @@ -273,17 +272,26 @@ they are listed:
.. tab:: Web Identity Token File
:tabid: web-identity-token-file

You can use the OpenID Connect (OIDC) token obtained from a web identity provider to authenticate
to Amazon Elastic Kubernetes Service (EKS) or other services.
To use an OIDC token, create a file that contains your token, then
set the absolute path to this file in an environment variable by using
a shell as shown in the following example:
You can use the OpenID Connect (OIDC) token obtained from a web
identity provider to authenticate to Amazon Elastic Kubernetes
Service (EKS) or other services. To use an OIDC token, create or
locate the file that contains your token. Then, set the following
environment variables:

- ``AWS_WEB_IDENTITY_TOKEN_FILE``: Set to the absolute path of the
file that contains your OIDC token.

- ``AWS_ROLE_ARN``: Set to the IAM role used to connect to your
cluster, for example ``arn:aws:iam::111122223333:role/my-role``.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I: comma splice

Suggested change
cluster, for example ``arn:aws:iam::111122223333:role/my-role``.
cluster. For example: ``arn:aws:iam::111122223333:role/my-role``.


The following shell command sets these environment variables:

.. code-block:: bash

export AWS_WEB_IDENTITY_TOKEN_FILE=<absolute path to file containing your OIDC token>
export AWS_WEB_IDENTITY_TOKEN_FILE=<path to file that contains OIDC token>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

S: my sense is that 'absolute' is important here, to distinguish this from the relative path, but maybe i'm overthinking

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A relative path should work fine here, although an absolute path is sometimes recommended.

export AWS_ROLE_ARN=<IAM role name>

After you've set the preceding environment variable, specify the ``MONGODB-AWS``
After you set the preceding environment variables, specify the ``MONGODB-AWS``
authentication mechanism as shown in the following example:

.. literalinclude:: /includes/fundamentals/code-snippets/authentication/aws-environment-variables.go
Expand Down
3 changes: 2 additions & 1 deletion source/fundamentals/crud/read-operations.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ Read Operations
:caption: Read Operations

Query </fundamentals/crud/read-operations/query-document>
Retrieve Data </fundamentals/crud/read-operations/retrieve>
Count Documents </fundamentals/crud/read-operations/count>
Data Cursors </fundamentals/crud/read-operations/cursor>
Distinct Field Values </fundamentals/crud/read-operations/distinct>
Expand All @@ -22,8 +23,8 @@ Read Operations
Monitor Data Changes </fundamentals/crud/read-operations/changestream>

- :ref:`golang-query-document`
- :ref:`golang-count-documents`
- :ref:`golang-retrieve`
- :ref:`golang-count-documents`
- :ref:`golang-cursor`
- :ref:`golang-retrieve-distinct`
- :ref:`golang-sort-results`
Expand Down
2 changes: 0 additions & 2 deletions source/fundamentals/crud/read-operations/retrieve.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@
Retrieve Data
==============

.. default-domain:: mongodb

.. contents:: On this page
:local:
:backlinks: none
Expand Down
6 changes: 2 additions & 4 deletions source/usage-examples/count.txt
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
.. _golang-count-usage-example:

=============================
==============================
Count Documents Method Example
=============================

.. default-domain:: mongodb
==============================

You can get an approximation on the number of documents in a
collection by using the ``EstimatedDocumentCount()`` method and an exact
Expand Down
Loading