EC2 Deployment Guide
EC2 Instance Recommendations
Every company is unique in many ways, and their communication needs are no different! Years ago, it was easy to recommend hardware specs for Asterisk-based PBX systems. However, these days, VoIP has evolved into a total communication platform. While we will provide some general guidelines for EC2 hardware, it will be important to regularly check your server resources to ensure you on a properly sized-instance. This is especially true when first placing your new AWS FreePBX instance into production and any time your company experiences growth or drastic changes in the way you do business. One of the best features of AWS is the ability to change EC2 Instance Types and Sizes at any time, so you can rest assured that a proper balance between performance and cost can be achieved regardless of your company's size, now and in the future!
We'll discuss EC2 Instances and AWS FreePBX from two perspectives:
EC2 Hardware Types and when to use "non-General Purpose" Types
CPU/RAM (EC2 Hardware Size) considerations based on calling environment
-EC2 Hardware Types-
For most environments where you simply want to take advantage of the normal suite of FreePBX services (calling, voicemail, fax, conferences, etc), the General Purpose Instance types (T3, T3a, M5, M5a) will provide the best combination of performance and value. If you are using a minimum amount of "intensive" services like conference rooms and queues, the T3 (Xeon) or T3a (EPYC) types will suffice. If you are planning to host a lot of conference rooms and/or queues, you will want to take advantage of the more dedicated performance of M5 (Xeon) or M5a (EPYC) types.
If you plan to use "extra" software on or alongside your AWS FreePBX instance, such as iSymphony or Queue Metrics, you need to be aware that each of these softwares have their own hardware requirements. For example, iSymphony is a PHP-heavy Java application that requires significantly more CPU and RAM resources in addition to what Asterisk and FreePBX need. iSymphony's RAM requirements can easily exceed 3 or 4GB on very large deployments and/or busy call centers. You may want to take advantage of the Compute Optimized (C5, C5n) - which provides extra CPU cores - or Memory Optimized (R5, R5a) types - which provides extra RAM, depending on the software you are deploying alongside AWS FreePBX.
Here are some other special use cases where you will keep other considerations in mind:
If you are planning to run an HA Cluster, DO NOT USE A T2|T3|T3a INSTANCE TYPE! Clusters have higher consistent CPU loads than the T-types can provide due to their burst-based nature. You must use an M5|M5a|C5|C5n|R5|R5a type for your HA Cluster nodes, sized at least one size larger (EX: 4xlarge instead of 2xlarge) than discussed in the chart below to account for cluster overhead
Voice Recognition and Text to Speech heavy deployments will likely benefit best from the Compute Optimized (C5, C5n) types
Call Centers with Outbound Dialers or a large number of Inbound Call Queues will likely benefit from the Memory Optimized (R5, R5a) types
-EC2 Hardware Sizes-
This is the more difficult aspect to predict ahead of a deployment, as there are many factors that ultimately determine the size of instance (CPUs/RAM) you choose. You should also note that Compute Optimized and Memory Optimized sizes have unbalanced hardware specs when compared to General Purpose types. Of course, once your server is in production, it is important to periodically check the resource usage on your FreePBX instance during times of PEAK CALL VOLUME to ensure you are using the correct size for your needs. An instance sized too small will lead to instability, audio issues, dropped calls, and even server crashes. An instance sized too large will waste money.
For most environments involving General Purpose types (T3, T3a, M5, M5a), this chart will serve as a good starting point:
-GP Instance Size-
(T3|T3a only) Small
(T3|T3a only) Medium
(M5|M5a only) 4xLarge
(M5|M5a only) 12xLarge
(M5|M5a only) 24xLarge
-# of Simultaneous Calls-
50 (T3|T3a) to 75 (M5|M5a)
100 (T3|T3a) to 125 (M5|M5a)
175 (T3|T3a) to 250 (M5|M5a)
Once you have placed your instance in production, you'll want to monitor your resources during periods of peak call activity and adjust your instance size accordingly. Here are several ways to monitor your resources:
NEW! Check out the AWS Compute Optimizer, which will advise you as to whether you have over- or under-provisioned your AWS instances based on the most recent 14 days of resource usage. More information on the AWS Compute Optimizer can be found here
Connect to your instance via SSH and run 'htop' for a live view of CPU/RAM resources and running processes
Alternatively view CPU usage on the FreePBX Dashboard Statistics widget CPU section and compare the 5 minute load average to the number of CPUs available to your instance (determined by instance size). For example, if your running on a T3.Small instance with 2vCPUs and consistently see your 5 minute load average rise above 2.0, then you are running your ALL of your CPU cores at 100% and will likely run into issues if you don't increase your instance size to one with more CPU cores
Alternatively view RAM usage on the FreePBX Dashboard Statistics widget Memory section. If you are seeing greater than 70% of your RAM "In Use" during peak times, you could run into issues. This is especially true if using iSymphony
If using a T3|T3a Type, you will also want to view your CPU Credit Balance via the EC2 Console (select the Instance, choose the Monitoring tab below). If you are seeing your CPU Credit Balance reaching 0 during peak times, this means your CPU is bursting too much and is either being THROTTLED or you are being CHARGED EXTRA (if Unlimited mode is on). It is recommended that you increase to a larger T3|T3a size or switch to the M5|M5a Type in these cases
If you have any doubts as to the best Instance Type and Size for your needs, we're here to help! Simply use the blue button on the right to contact us via Live Chat or Email and we'll gladly discuss your needs to come up with a tailored recommendation for your company. For more information regarding resizing instance types on AWS EC2, please click here.
EBS Storage Recommendations
Next, you should take some time to consider how much storage space you need for your company or organization. The size and type of the independent spool volume is important to determine up front, as it is a time consuming (and OFFLINE) process to add/upgrade storage later. There are a few caveats to keep in mind:
The size of the ROOT volume (/dev/sda1) should always remain at the default 50GiB, as changing it requires additional work within CentOS after the fact and should not need to be larger than 50GiB in 99% of cases
Your SPOOL volume (/dev/sdb) is where all FAXES, VOICEMAILS, RECORDINGS, and all other user volatile data is stored.
Voicemail files such as greetings are stored in several duplicated file formats
Call Recordings are stored as UNCOMPRESSED WAV files in order to minimize CPU load while recording, so these files will get large if recording every single call in business types such as customer service, finance, or healthcare
In addition to how MUCH storage you need, you must also consider that there are (5) TYPES of storage on AWS EBS now, with varying costs per GiB versus speed of file transfer and access. Here's a basic breakdown of each of type and what you need to know about them:
General Purpose SSD (gp2) - $0.10-0.12/GB-month - All linux ROOT volumes (/dev/sda1) MUST use this type of volume. You will use this type for the SPOOL volume (/dev/sdb) for most deployments, as this provides the best performance for the price.
Provisioned IOPS SSD (io1) - $0.125-0.15/GB-month + $0.065-0.078/IOPS-month - This type will yield no noticeable performance benefit for your system over the General Purpose SSD (gp2), but costs a lot more. You'll want to avoid using this type unless you are certain you need it for some sort of advanced setup.
Magnetic - $0.05/GB-month + $0.05/million IO - AVOID using this a legacy type, which was offered as the only non-SSD type until mid-2016, when the next two types were introduced. You will want to use the next option below, instead, if you are looking to minimize costs on a VERY SMALL deployment. It offers better performance at a better price.
Throughput Optimized HDD (st1) - $0.045-0.054/GB-month - This is the new replacement for the legacy Magnetic type. It provides better performance than Magnetic at a cheaper price per GiB (in most regions). Use this type for the SPOOL volume (/dev/sdb) if you have a VERY SMALL deployment: under 15 simultaneous calls and NOT using Call Recording or iSymphony.
Cold HDD (sc1) - $0.03/GB-month - This is a new even slower/lower cost alternative. You should avoid using this type unless you are absolutely certain you know what you are doing: you are likely to experience storage bottlenecks very readily with this option, which could have various random side effects.
Detailed information on the performance of each type can be found by clicking here.
Once you have decided on an appropriate instance type, click the Launch an Instance button below (opens in a new tab/window) to open our AWS Marketplace Page. Then click Continue to proceed:
Be sure to select your desired Region on the Configure page, then choose Continue to Launch:
On the Launch page, it is important to select your desired EC2 Instance Type:
Then, scroll down and choose your Security Group and Key Pair. It is STRONGLY RECOMMENDED that you choose the Create New Based On Seller Settings button if this is your first AWS FreePBX instance in this Region, as it contains all the ports necessary for your server to operate properly. You may customize this new SG after launch to place additional restrictions. It is also VERY important that you use or create a new Key Pair and SAFELY RETAIN IT! You will need it to connect to your instance to perform updates and gain access to some of the more advanced features available to you. Once you have created the Security Group and Key Pair, you may click the Launch button
Once launched, YOU MUST ALLOCATE AND ASSIGN AN ELASTIC IP TO YOUR INSTANCE (click here for instructions), as this ensures proper function of call routing across the internet and ensures your IP doesn't change when you reboot. Use the standard process for assigning an elastic IP in the link above before proceeding in this guide. Once you have a public elastic IP address, you may proceed to the First Launch and Setup page.