Connecting to Amazon DocumentDB with MongoDB Drivers

Amazon DocumentDB offers a way for developers and DBAs to balance availability, read scalability, and latency with five pre-configured consistency levels. The data in an Amazon DocumentDB cluster is accessible just like a MongoDB 3.6 cluster. The CData Software Drivers for MongoDB provide a SQL-like interface to MongoDB data through standards-based drivers, allowing users to see their data in the BI, reporting, and ETL tools of their choice, as well as in custom tools and applications.

This article walks through configuring an Amazon DocumentDB cluster and connecting to the cluster through any of the available CData Software MongoDB drivers.

NOTE: To interact with your Amazon DocumentDB cluster, you must launch an Amazon Elastic Compute Cloud (Amazon EC2) instance into your default VPC, in the same AWS Region where you created your Amazon DocumentDB cluster and install the CData drivers onto the EC2 instance.

Creating a DocumentDB Cluster

To create a DocumentDB cluster, log in to your AWS Console, select Amazon DocumentDB, click Clusters and Create to add a new cluster. Once you create the cluster, you can connect to the cluster using the MongoDB client from an EC2 instance to populate the cluster. Once you have data in the Amazon DocumentDB cluster, you can connect using the CData MongoDB Drivers.

Connecting to a Amazon DocumentDB Cluster

With your cluster created, make note of the cluster details (found by clicking on the cluster name on the Clusters page).

The table below describes the mapping from the DocumentDB cluster details to the CData Driver properties:

CData Driver Property Amazon DocumentDB Property
Server Cluster endpoint
Port Port
User Master username
Password (set when you create the cluster)

In addition to the cluster details, you need to set a few more additional properties in the CData drivers to connect to an Amazon DocumentDB cluster:

  • UseSSL: True
    (Amazon DocumentDB Clusters have SSL enabled by default and this cannot be changed.)
  • SSLServerCert: *
    (This automatically accepts the certificate presented by the DocumentDB Cluster, which is already hosted within the same region and security group as the EC2 instance.)
  • Other: "UseFindAPI=true"
    (This is set to ensure compatibility with the DocumentDB version of the MongoDB API.)

With all of the properties, your standard connection string would look like the following:

Server=<cluster-name>.cluster-xxxxxxxxxxxx.<region>; Port=27107; User=myMaster; Password=myPassword; UseSSL=True; SSLServerCert=*; Other='UseFindAPI=True';

Once the connection properties are set, you can quickly connect to your Amazon DocumentDB account using any of the MongoDB Drivers. Download a free trial of any of the drivers to start working with your DocumentDB data in the BI, reporting, ETL, and custom tools that you are already using.