/

7. Prepare Red5 Pro AMI for Nodes


Note: After creating the server AMI, you will need to copy it to every region you wish to include in your autoscaling solution, per https://aws.amazon.com/blogs/aws/ec2-ami-copy-between-regions/

Note #2: The AWS platform does allow multiple images of the same name. Please make sure to use a unique name when creating the image to be used for autoscaling. If your region has more than one resource of the same name, the first one in the fetch images API operation will be used.

Note #3: If you are going to be using load-balanced stream managers, then you need to use the load balancer DNS name in the autoscale.xml file of your AMI.

Launch an Instance and Install Red5Pro

Start a Basic Instance:

  • Navigate to the EC2 Dashboard
  • From the left-hand navigation, under INSTANCES, click on Instances, then Launch Instance
  • Step 1: Choose an Amazon Machine Image (AMI) - Select the “Ubuntu Server 20.04 LTS (HVM)”
  • Step 2: Choose an Instance Type - Recommended minimum c5.large for price and performance. Click on Next: Configure Instance Details
  • Step 3: Configure Instance Details - Network: choose the VPC created for autoscaling in that region. Ensure that “Auto-assign Public IP” is set to Enable; accept all other defaults.
  • Click on Next: Add storage - increase from the default 8G to 16G or more; click on Next: Tag Instance; click on Next: Configure Security Group
  • Step 6: Configure Security Group - choose “Select an existing security group” and choose the group you created above.
  • Click Review and Launch
  • Click Launch
  • In the final step when prompted, Choose an existing key pair, and select the public key that was created earlier

Install Red5Pro on the Instance

  • Follow the Installing Red5Pro on a Linux Server instructions
  • Make sure that Red5 Pro service is set to auto-start on launch
  • Connect to your instance using the private key from the key pair that you created
  • ssh -i ~/.ssh/keys/red5prokey ubuntu@<server_ip_address>
  • Red5 Pro Clustering does not work without a license. You will need to purchase a Red5 Pro Professional license from http://account.red5.net. Add a file named LICENSE.KEY with your Pro license key (16 characters, plus dashes, like: YOUR-LIC-ENSE-KEY1) to the root of the Red5 Pro Server installation ({red5prohome}/LICENSE.KEY)

If you haven't already, Install NTP (network time protocol). NTP is necessary to ensure that the Stream Manager and all nodes are in sync. sudo apt-get install ntp The service should start automatically once installed.

Configure Autoscaling on the Instance

Navigate to the location where you extracted the red5pro files, and edit the file {red5prohome}/conf/autoscale.xml

  • Change the active value from “false” to “true
  • Replace http://0.0.0.0:5080 with https://your-streammanager-url
  • Save and close the file

example:

    <bean name="config" class="com.red5pro.clustering.autoscale.Configuration" >
        <property name="active" value="true"/>

        <!--Stream manager hosted uri. use the host of your stream manager.  -->
                <property name="cloudWatchHost" value="https://red5autoscale.red5pro.com/streammanager/cloudwatch"/>

Set a Unique Cluster Password

Edit the file {red5prohome}/conf/cluster.xml and replace the default <!-- edge/origin link cluster password --> password from changeme to a unique value. Make a note of this password, to be used in the Stream Manager red5.properties file.

Remove Unnecessary Webapps

To ensure a faster startup time for your server, we suggest deleting any webapps that you will not be using from the {red5pro}/webapps directory (for example: template, streammanager; do not remove root). For ease of setup for the Stream Manager, leave a zipped copy of the server distribution on the server.

In addition, it is recommended that you remove any plugins (found in the red5pro/plugins directory) which you will not be using, from the following list:

  • red5pro-mpegts* -- HLS
  • red5pro-restreamer* -- restreamer
  • red5pro-socialpusher* -- social media restreaming

Verifying Red5 Pro on Instance

Start Red5 Pro service

sudo systemctl start red5pro

Once you have started the Red5 Pro Server, you can verify that it is running and available by opening a web browser and navigating to http://<server-ip>:5080, where is the Public address value of your Red5 Pro server.

After you've verified, stop the Red5 Pro service

sudo systemctl stop red5pro

Create AMI Image from Instance

To create an AMI, to be used by autoscaling for node creation:

  • Navigate to the EC2 Dashboard, click on Running Instances, and select your instance.
  • Click on “Actions” => “Image” => “Create Image”
  • In the “Create Image” popup window enter a unique image name and description and click create image. Leave additional default settings. Make a note of the image name - you will need this for the stream manager launchconfig.
  • You can now stop (or terminate) the instance (NOT the AMI). You will not be charged by Red5 Pro for a server instance that is running for fewer than 15 minutes.
  • If your nodegroups span multiple regions, you will need to copy the AMI to each (detailed in the next step)
  • NOTE: as of Server Release 7.0 (Stream Manager API 4.0) you can use different images for different node types. This can be especially handy if, for example, you want to support HLS recording but not live streams. In this case, you could remove the mpegts plugin on the EDGE or RELAY server image. You could also, for example, create an image on a larger instance type and allocate more memory.