<a id="cc-mongo-db-sink-eap-azure"></a>

# Egress Private Link Endpoint Setup: MongoDB Atlas on Azure for Confluent Cloud

The MongoDB Atlas Sink connector for Confluent Cloud supports Azure Private Link
connectivity through Egress Private Link Endpoints. Use this guide to
configure the connector and set up the required endpoints.

## Prerequisites

The following is a list of prerequisites for configuring the MongoDB Altas
connector with an Egress Private Link Endpoint:

* In Confluent Cloud, one of the following cluster types was set up with the specified
  network resource:
  * A Dedicated cluster with a Confluent Cloud network

    For the steps to create a Confluent Cloud network, see [Create a Confluent Cloud network](../../networking/ccloud-network/azure.md#ccn-config-azure). The Connection
    type of the network needs to be “Private Link Access”.
  * A Enterprise cluster with a network gateway

    For the steps to create a gateway, see
    [Create a gateway for outbound connectivity in Confluent Cloud](../../networking/azure-egress-privatelink-esku.md#azure-privatelink-egress-create-gateway-esku).
* A Dedicated MongoDB Atlas database was created to sink data into and is
  running within the same region and cloud as the Confluent Cloud cluster.
* A source topic was created to sink data into MongoDB Atlas.

<a id="cc-mongo-db-sink-eap-azure-create-endpoint"></a>

## Step 1. Create a MongoDB private endpoint

In MongoDB, create a private endpoint for your Dedicated MongoDB Atlas
database:

1. Go to **Network Access** → **Private Endpoint** → **Dedicated Cluster**.
2. Click **Add Private Endpoint**.
3. Select the applicable cloud provider and region of your Dedicated MongoDB
   Atlas database.
4. Make a note of the Atlas Endpoint Service value which is required for
   creating a Confluent Cloud Egress Private Link Endpoint.
   ![image](connectors/cc-mongo-db-sink/images-azure/atlas-endpoint-service.png)
5. You can close the workflow for now. You will edit the rest of the
   configuration after you create a VPC endpoint ID in Confluent Cloud.

<a id="cc-mongo-db-sink-eap-azure-access-point"></a>

## Step 2. Create an Egress Private Link Endpoint

Confluent Cloud Egress Private Link Endpoints are [Azure Private Endpoints](https://learn.microsoft.com/en-us/azure/private-link/private-endpoint-overview)
used to connect to Azure Private Link Services.

### Dedicated cluster

1. In the **Network management** page or tab of the desired Confluent Cloud environment,
   click the Confluent Cloud network you want to add the Private Link Endpoint
   to. The **Connection Type** of the network needs to be “Private Link
   Access”.
2. Click **Create endpoint** in the **Egress connections**
   tab.
3. Click the service you want to connect to, specifically, **MongoDB**.
4. Follow the guided steps to specify the field values, including:
   * **Name**: The name of the Private Link Endpoint.
   * **Resource ID**: The resource ID/Endpoint Service value of the Private Link
     service you retrieved in [Step 1](#cc-mongo-db-sink-eap-azure-create-endpoint).

     Note that the resource alias is not supported.
   * **Sub-resource name**: Leave blank.
5. Click **Create** to create the Private Link Endpoint.
6. If there are additional steps for the specific target service, follow
   the prompt to complete the tasks, and then click **Finish**.
7. Once the status of the Egress Private Link Endpoint changes from “Provisioning” to
   “Pending”, make a note of the **Resource ID** and **IP Address** values.
   The values are required to finish setting up a private endpoint for
   MongoDB Atlas.
   ![image](connectors/cc-mongo-db-sink/images-azure/atlas-db-resource-id.png)

### Enterprise cluster

1. In the **Network management** page or tab of the desired Confluent Cloud environment,
   click the **For serverless products** tab.
2. Click the gateway to which you want to add the Private Link Endpoint.
3. In the **Access points** tab, click **Add access point**.
4. Click the service you want to connect to, specifically, **MongoDB**.
5. Follow the guided steps to specify the field values, including:
   * **Access point name**: The name of the Private Link Endpoint.
   * **Resource ID**: The resource ID/Endpoint Service value of the Private Link
     service you retrieved in [Step 1](#cc-mongo-db-sink-eap-azure-create-endpoint).

     Note that the resource alias is not supported.
   * **Sub-resource name**: Leave blank.
6. Click **Create access point** to create the Private Link Endpoint.
7. If there are additional steps for the specific target service, follow
   the prompt to complete the tasks, and then click **Finish**.

## Step 3. Configure the MongoDB private endpoint

1. In the MongoDB console, click **Edit** for the previously created MongoDB private endpoint.
2. Click **Next**.
3. Specify the **Endpoint Resource ID** and **Private Endpoint IP Address**
   associated with your Confluent Cloud Egress Private Link Endpoint. Click **Create**.
   ![image](connectors/cc-mongo-db-sink/images-azure/private-endpoint-resource-id.png)
4. Once Endpoint Status changes to “Available”, you are ready to create the
   Confluent Cloud MongoDB Sink connector.

## Step 4. Create the MongoDB Atlas Sink connector

1. Specify the authentication details for MongoDB.
   1. In the MongoDB Atlas console, click **Database** under **Deployment**.
   2. Click **Connect** for the associated database.
   3. Select the **Private Endpoint** connection type, and select the endpoint
      you created in Step 3.
   4. Click **Choose a connection method**.
   5. Select **Shell** in the Access your data through tools section.
   6. Get the endpoint as shown.
      ![image](connectors/cc-mongo-db-sink/images-azure/atlas-db-endpoint.png)
   7. In Confluent Cloud, specify the MongoDB credentials during the connector
      creation steps.

      In the **Connection host** field, specify the endpoint you retrieved in
      the previous step.

      #### NOTE
      When you configure a private endpoint, ensure that the standard
      hostname matches the correct private link endpoint, for example
      “-pl-0” as shown in the screen below.

      ![image](connectors/cc-mongo-db-sink/images-azure/connection-host.png)
2. Follow the steps to create the [source connector](../cc-mongo-db-source.md#cc-mongo-db-source)
   or the [sink connector](cc-mongo-db-sink.md#cc-mongo-db-sink) in Confluent Cloud.
