You can create Ant Media Server global cluster on AWS to serve your videos to the users from different locations of the world with better performance. We have published a blog post as a guide to create Ant Media Cluster on AWS. In this blog we will tell how you can create a global cluster. We named a cluster as global cluster if it contains instances from different geolocations. For example if you have such an application that users connect different location of world, you may need Global Cluster to obtain better performance.

ant media global cluster

Ant Media Global Cluster

Prerequisites

AWS Route53 service is the critical part of a global cluster. Route53 service directs request coming from different geolacations to the different servers. You can get more information about Route53 from AWS documentation. Also we are planning to publish a blog post about Route53 usage.

We assume that you have created a hosted zone using Route53.

Step 1: Start AMS Instances from different locations

In this step you will start instances from where you want to add a node.  You must be create an instance by using Ant Media Server AMI. You can read this post as a guide for this step.

Step 2: Install MongoDB

Ant Media Server needs MongoDB in cluster mode. So you must install MongoDB to an instance. You can start a new instance or use any cluster node for MongoDB. You can read the Step1 in this post.

Step 3: Add hosted zone record set in AWS

After you create instances from different data centers you must map geolocations to these instances. You have to create a record set for each mapping. Here, you specify which zone users connect to which volume. For example look at the record set below. In this example users in Europe are directed an instance if we enter its IP in the Value part of the form.

record set creation

Route53 Record Set Creation

Step 4: Enable SSL

We have two methods in Ant Media Serve for SSL enabling.

The first one is told in this blog post. In this method Lets Encrypt provides an SSL certificate only if it can access the server you try to get certificate. So you must guarantee that it access the correct instance behind the Route53. You can map default geolocation to the instance you work on and map others to Antartica.

The second one is here. In this method you get SSL Certificate on AWS Certificate Manager.

You can use one of these two methods.

Step 5: Enable cluster mode

After AMS installation and enabling SSL you will enable cluster mode in your AMS instance. To do this you will run the change_server_mode.sh  script under /usr/local/antmedia. You must run it as:

sudo ./change_server_mode.sh cluster <mongo_ip> true

Step 6: Verification

You should be ready now. To verify your global cluster, you can use this web site:

You will see different IP for different geolocations.

Categories: Tutorial