If you are looking for an alternative to the Ubiquiti Enterprise Unifi service, hosting your UniFi server on AWS is a great alternative. Plus it’s super easy! If you have a VMware ESXi server I have created a virtual appliance that allows you to get up and running quickly too. Don’t have VMware at home? Well then an AWS instance might be great for you, here is how to do it in less than 10 minutes!
Instead of creating a virtual appliance that you could use in AWS, we are going to use the standard Ubuntu 16.04 LTS AMI that AWS created, along with a script that will do all the work for you!
So this tutorial will walk you through how to create an AWS instance that runs a startup script. The rest of the Unifi stuff is all installed on first boot, which means you get the latest and greatest right from the start!
The only thing I won’t go through in this post is how to create an AWS account. There are plenty of great posts out there on how to do that part.
Step 1 – Login to AWS and Start New EC2 Instance Wizard
After logging into the AWS console, click on the EC2 service.
Next, make sure you are working in the region you prefer, more than likely you will want to select a region close to you. In this screenshot, you can see that “Oregon” is selected, I would want to change this to “Ohio” since it’s closer to me.
Ok, the last thing we need to do on the EC2 page is to click on the “Launch Instance” button to start the EC2 Instance wizard.
Step 2 – Select Instance type and size
Now that we are in the EC2 Instance Wizard we want to select the Ubuntu 16.04 LTS image.
On the next page, we are asked which size of instance we would like. Unifi requirements say 2GB of RAM, and at least 10GB of Hard Drive space, or more depending on how many devices you plan to manage. I would recommend starting with the t2.small, as you can always shut down the machine and make it larger later on.
After selecting the size you want to, select “Next: Configure Instance Details.”
Step 3 – Config Instance Details and Storage
Ok so on the Instance Details page is where the magic happens. This is the page where we will paste our startup script that installs Unifi.
First, let’s make sure that our instance gets a public IP address, so select Enable. Next, let’s expand the “Advanced” section at the bottom.
In the Advanced Details section, we need to paste the following script.
sudo apt update
sudo apt upgrade -y
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv 06E85760C0A52C50
sudo add-apt-repository "deb http://www.ui.com/downloads/unifi/debian stable ubiquiti"
sudo apt update
sudo apt install unifi -y
sudo apt-get install haveged -y
It should look something like this when you are done.
On the storage page, change 8GB to 20GB, if you plan to manage more than 50 devices, you may want to add a little more storage as well.
Click the button to continue to the security configuration.
Step 4 – Configure Firewall rules
On the Security page, we will configure the firewall for our instance. We need to allow all the ports that Unifi uses to pass through to the instance. The list of ports required is here, I have copied the chart below we well
Once you add them all in your security page should look like this, note that I changed the security group name and description as well so it’s easy to understand what it goes to later on:
Next, click review and Launch.
Step 5 – Launch Instance
On the review page double check the settings then click Launch. Once you do that you will be asked if we want to use an existing key pair, or create a new key pair. If you have not used AWS before it will require you to create a new key pair. Give it a name, then click Download. Once you have downloaded the PEM file, the Launch Instance button will turn blue and you can click to launch your Unifi Controller.
The controller will take approximately 5 minutes to provision and run the boot script. Click on the instance ID on the summary page to go back to the EC2 dashboard and monitor the instances progress.
Step 6 – Connect and Configure Unifi
The last step is to figure out what our instance’s IP address is and connect to it so it can be configured.
To find the IP address locate your Unifi Controller instance and click once to highlight it. Now you have two options scroll to the right to see the Public IP column, or look in the lower section and
Once you have the IP address, you can connect to your new controller by typing https://<your public ip>:8443 in your browser.
You should get a security warning from your browser, for Chrome click Advanced then Proceed to continue past the warning.
Finally, you are at the configure page for your new controller. You can configure it just like any other Unifi Controller.
At this point, you should be able to connect to the Unifi web interface via the IP address that AWS has assigned. Once you do that you can set up your devices to connect to a remote Unifi controller.
Ubiquiti has a great how-to on doing this. Check it out here:
If you found this useful, leave a comment and let me know that you were able to create your controller with these steps… or share the post on social media so someone else can use it too!