Table of Contents

Warm Spare HA

The latest versions of FreePBX support a very simple and competent Warm Spare strategy.

At the present time, the only way to achieve an automated fail over in the event of a random service failure is with Sangoma's Advanced Recovery module license. While the Advanced Recovery module will work with AWS FreePBX and we fully support its use, the $800/year ($400/server/year) licensing cost puts it out of budgetary reach for many small customers who will already be paying for two AWS FreePBX instances. The Advanced Recovery module is NOT AT ALL required to use Warm Spare HA strategies, as manually switching to the Backup instance is as simple as swapping the Elastic IP and, in some cases, enabling Trunks. This recludes the $800/yr Commercial Module for automated fail-over and sync-back. The choice is yours and you can switch to the Advanced Recovery module any time in the future.

This guide will show you how to setup Manual Warm Spare High Availability with AWS FreePBX.


Prerequisites

Both Instances should be in the same Region so they can share the Elastic IP, but should be in different Availability Zones to ensure a single AWS AZ failure doesn't take down both Instances. Using a multi-Region schema requires a much more advanced setup that won't be covered in this guide.

Both Instances require independent Activation/Deployment IDs and identical sets of Commercial Modules Licenses from Sangoma - it is not possible to share a single Deployment ID between the Instances

Using a Private IP or VPN schema requires a much more advanced setup that won't be covered in this guide


Setup Guide

Throughout the steps below, we will be switching back and forth between the Primary and Secondary Instances in order to complete steps via both the GUI and SSH. To save time, have the GUIs of both Primary and Secondary Instances loaded/logged into your browser and establish a single SSH connection to the Secondary Instance.

Remember that a newly launched instance will have a GUI 'admin' password set to the Instance ID (I-xxxxxxxxxxxxxxx).



1: Obtain Primary Public Key from Primary Instance



2: Install Primary Public Key on Secondary Instance via SSH



3: Create a new SSH FileStore on Primary Instance



3a: (Optional) Create a second S3 FileStore on Primary

If you wish to keep an additional copy of your most recent backup file in an S3 Bucket, setup a second FileStore connecting to S3.

This is strongly advised, as it can help you can restore your config and data even if both Production and Backup Instances are somehow lost or damaged.



4: Create a new API Connection on Secondar Instance



5: Create a new Backup Job on Primary Instance

If you acquire the Client Access Token successfully, you may now Save the backup job.

6: Add Secondary Local Network to Primary Instance

This step is necessary so, when a fail-over is performed, calls are routed over NAT correctly. First, navigate the Secondary Instance GUI to Settings > Asterisk SIP Settings

If the Local Networks field is empty, click the Detect Network Settings button to populate the fields. Then make note of the CIDR presented (usually 172.31.x.0 / 20)

Navigate the Primary Instance GUI to Settings > Asterisk SIP Settings and paste the CIDR you copied from the Backup Instance or your VPC Subnet information. If an extra blank field is not showing, click the Add Local Network Field button. You should now have two sets of Local Networks showing, one for each Instance.

If you have both Instances in a single Availability Zone, they will have the same Local Network CIDR and you do not need to duplicate this entry in the list!

Your Warm Spare Setup is now complete. Data will be cloned from the Production Instance to the Backup Instance once per hour to keep it up-to-date.




The following sections cover additional information about Warm Spare High Availability Strategies, such as how to Fail Over and Upgrade your Instances.

How to Fail Over to the Secondary Instance

If your Production Instance fails for any reason or you need to keep call services active while you upgrade the Production Instance (24-hour offices, etc), switching to the Backup Instance is as simple as moving your Elastic IP to the Backup Instance via the EC2 Console or AWS APIs.



How to Upgrade your Instance

If you need keep call services active during the upgrade, you may fail over to the Secondary Instance before proceeding

If you failed over to the Secondary Instance to start with, you should switch back to Primary at this time



How to Promote the Secondary Instance to Permanent Primary role

  1. Ensure the old Primary Instance can't interfere with the Secondary Instance by removing the old credentials from the Secondary Instance
    1. Remove the “ssh-rsa…” line from /root/.ssh/authorized_keys:
      • nano /root/.ssh/authorized_keys
    2. Remove the API Machine-to-Machine Application Connection from Connectivity > API
  2. Switch over to the Secondary Instance
    1. Swap Elastic IP to Secondary Instance via the EC2 Console or AWS API
    2. Enable Trunks on the Secondary Instance, if necessary

The Secondary Instance is now your Primary Instance. Follow this guide from the start to setup a new Secondary Instance and restore redundancy.