Skip to main content

Scaling with AWS DocumentDB

AWS DocumentDB is a managed database service designed for scalability, high availability, and compatibility with MongoDB workloads. It simplifies the deployment and management of databases while providing the flexibility to build robust and performant global applications on AWS.

In this document, we'll explain how to use AWS DocumentDB with Ant Media Server.

Prerequisites

  • Your AMS (standalone or cluster) server should operate on the same VPC as your DocumentDB.
  • TLS must be disabled in DocumentDB.

Creating AWS DocumentDB

Follow below steps to create Document DB cluster and connect AMS to the database.

Create Parameter Groups

First, open the Amazon DocumentDB service and go to the Parameter groups sections, as shown below.

Now, create Parameter Groups to disable TLS.

Select tls from the cluster parameters, click Edit and disable TLS.

Create Document DB cluster

Now go to the Clusters tab and click the Create button to create a new cluster. Select the instance class and number of instances as required.

Their is no need to change any parameter. Define your username and password for authentication and then go to advanced settings.

In advance settings, choose the Cluster Parameter Group you created in previous step, and click Create to create your cluster.

Once the DocumentDB setup is complete, select your cluster, go to the Connectivity & Security tab, and obtain the connection string.

You can now use this information in Ant Media Server.

Connect AMS to Document DB cluster

To connect AMS with Document DB, you need to use the mongodb+srv connection string copied from the cluster in above steps.

Now go to /usr/local/antmedia directory and run below command:

sudo ./change_server_mode.sh cluster mongodb+srv://username:password@url

Here is the sample command to connect with Document DB.

sudo ./change_server_mode.sh cluster "mongodb://testadmin:password@docdb-2024-08-25-19-28-55.cluster-crg1b1lxnbdb.ap-south-1.docdb.amazonaws.com:27017/?replicaSet=rs0&readPreference=secondaryPreferred&retryWrites=false"