In this blog post, we will tell you how to install the Ant Media Server cluster in a short time by uploading the template file via CloudFormation which is prepared for AWS. First, let’s explain what the CloudFormation is about.

What is CloudFormation?

AWS CloudFormation is a configuration orchestration tool that allows you to codify your infrastructure to automate your deployments and its templates are JSON or YAML-formatted text files. In short, CloudFormation is an AWS service that allows you to describe and provision your AWS infrastructure using a simple text file.

Setting up an Ant Media Server Scaling Solution with CloudFormation 1

CloudFormation Installation For Scaling Ant Media Server

Now let’s start on to the CloudFormation setup and continue step by step.

1. Firstly, let’s subscribe to the Ant Media Server on the Amazon Marketplace. Open the link: https://aws.amazon.com/marketplace/pp/B07569Y9SJ/ then please proceed by clicking “Continue to Subscribe” button.

Setting up an Ant Media Server Scaling Solution with CloudFormation 2

2. Please proceed by clicking “Accept Terms” button

Setting up an Ant Media Server Scaling Solution with CloudFormation 3

3. if everything goes well, you will see the screenshot below.

Setting up an Ant Media Server Scaling Solution with CloudFormation 4

4. Now, download the CloudFormation template from the below link to your computer.

Link: https://raw.githubusercontent.com/ant-media/Scripts/master/antmedia-aws-autoscale-template.yml

5. Log in to the AWS Dashboard and find CloudFormation in the search box.

CloudFormation ant media server

 

6. Click on “Create Stack” from the menu.

CloudFormation Start Page

7. Select “Upload a Template File” and upload the downloaded file.

aws cloudformation screen

8. The menu that below is where we will adjust all our settings.

Ant media server cloud formation setup– Stack Name: it will describe your stacks, it will be like a skeleton
– AntMediaEdgeCapacity: How many Edge servers will be created.
– AntMediaEdgeCapacityMax: Edge Server where Auto Scale will reach maximum
– AntMediaOriginCapacity: How many Origin servers will be created.
– AntMediaOriginCapacityMax: Origin Server where Auto Scale will reach maximum
– CPUPolicyTargetValue: Average CPU utilization of the Auto Scaling group. When the server reaches %60 CPU utilization average, new servers will be added
– EdgeInstanceType: Edge Instance Type

aws cloudformation interface

– Email: Subscription Email
– KeyName: An Amazon EC2 key pair name.
– LoadBalancerCertificateArn: Amazon Resource Name (ARN) of the certificate to associate with the load balancer. Please check this guide: https://antmedia.io/ssl-from-aws-certificate-manager-for-domain-name/
– MongoDBInstanceType: MongoDB Instance Type
– OriginInstanceType: Origin Server Instance Type
– SSHLocation: The IP address range that can be used to SSH to the EC2 instances
– Subnets: The list of SubnetIDs in your Virtual Private Cloud (VPC)
– VpcCidrBlock: Associates a CIDR block with your VPC. It should be the same as the VPC Network.
– VpcId: The physical ID of the VPC

9. Please proceed by clicking “Next” button

aws cloud formation

10. In this section, you can view and check the summary of the parameters you have entered and you can edit it here as below.Setting up an Ant Media Server Scaling Solution with CloudFormation 5

We are using AWS Lambda, so IAM permissions are needed to get our latest image.

AWS Lambda

 

11. If the template has been installed successfully, it says “Create Complete” in the red rectangle.aws ant media cluster

12. You can access the URL addresses for LoadBalancer HTTP and HTTPS in the Outputs tab. If you define the CNAME record for the domain you have defined on Certificate Manager to the Load Balancer address below, you can access Ant Media Server without a certificate error on the domain you have defined.ant media cluster

13. When you type the URL of the Loadbalancer, Ant Media Dashboard will be opened as below.ant media login screen

When you click on the Cluster tab, you can see the servers in Cluster.

Ant media server in Cluster.

14. When you delete a stack, the AWS CloudFormation deletes all resources in that stack.
AWS CloudFormation deletes

I have covered most of the topics around Cloud Formation. Coming to the question of what we have gained by using CloudFormation and Ant Media Server template, the following steps will take place while sipping your coffee.

– EC2 instance
– Security group
– Ant Media Server Installation
– Ant Media Server Cluster Configuration
– AutoScale
– Load Balancer

Our next blog will be about how Ant Media Server will handle 50K and 100K. Stay tuned!
If you have any questions, please just drop a line to contact (at) antmedia.io

Categories: Tutorial