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.
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
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).
/root/.ssh/authorized_keys
sudo su
nano /root/.ssh/authorized_keys
SubmitBackup Node22root/home/asterisk/.ssh/id_rsa
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.
Add User. Enter a Username (this is for your reference only) and choose the Programmatic Access option. Then select the Attach Existing Policies Directly tab and search for the AmazonS3FullAccess permission. Once you click the Create User button on the last page, you MUST save the Access Key ID and Secret Access Key (click the 'show' link) to setup the FileStore connection. You can also download this information in csv format for your records. If this information becomes compromised in the future, you can return to this page, delete the user, create a new one, and reprogram the FileStore with the new keys.SubmitFreePBX Backups
Exclude Trunks = YesModules > Core > Disable Trunks on Restore = YesExclude Trunks = YesModules > Core > Disable Trunks on Restore = YesWarm SpareBackup & Restore, FileStore, SIPSTATION (see caveats above!)SSH > Backup Node (also check S3 > FreePBX Backups, if setup in 3a*)Yes; Scheduling = Every Hour1YesNoNoYesNoYes No (see caveats above!)API Backup Node
If you acquire the Client Access Token successfully, you may now Save the backup job.
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.
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.
If you need keep call services active during the upgrade, you may fail over to the Secondary Instance before proceeding
Admin > Backup and Restore on the Primary InstanceSchedule Enabled to No, then Savesmartupgrade –autoIf you failed over to the Secondary Instance to start with, you should switch back to Primary at this time
smartupgrade –autoAdmin > Backup and Restore on the Primary InstanceWarm Spare job, change Schedule Enabled to Yes, then Save
/root/.ssh/authorized_keys: nano /root/.ssh/authorized_keysConnectivity > APIThe Secondary Instance is now your Primary Instance. Follow this guide from the start to setup a new Secondary Instance and restore redundancy.