DEV Community

alakkadshaw
alakkadshaw

Posted on • Originally published at metered.ca

Azure Turn Server: The Step by Step Guide

In this article we are going to learn how to setup a TURN server in Azure, along with what costs and considerations (Maintenance and Attack protection etc) will be there in running a TURN server on Azure

Metered TURN server

Metered TURN server can be a good alternative to running your own TURN server on Azure.

With 99.999% uptime, email support, automatic geo targeting where your users are you get a better performance than running your own TURN server

Plus, Metered TURN server all maintenance and protection needs are taken care of.

Here are some of the features of Metered TURN servers:

✅ Runs on port 80 and 443
✅ Tested to bypass most firewall rules
✅ Enterprise grade reliability (99.999% uptime)
✅ Support TURNS + SSL to allow connections through deep packet inspection firewalls.
✅ Support STUN
✅ Supports both TCP and UDP
✅ Dynamic routing to the nearest server
Now let's continue with creating a TURN server on Azure

Step 1 Creating an account

you are going to need an account. You can create one by going to the and signing in with your email or Microsoft account

Once you sign up, you land in the dashboard area there you can create various services like creating a resource or a database

Image description

Step 2 Selecting an Machine

Next click on the Create a resource and then click on the Ubuntu server, any ubuntu or linux operating system would work.

Regarding the size of the machine and bandwidth requirements you need to decide for your self or do a trial and error depending on your requirements

Image description

Step 3 Installing TURN server

With regards to installing the turn server. ssh in your azure machine that you just created and then

Type the below code to update the operating system

sudo apt-get update
Enter fullscreen mode Exit fullscreen mode

and

sudo apt-get upgrade
Enter fullscreen mode Exit fullscreen mode

then install the free turn server Coturn

sudo apt-get install coturn
Enter fullscreen mode Exit fullscreen mode

Set the coturn to start automatically when the instance starts

go to file etc/default/coturn

and edit the file using

sudo nano /etc/default/coturn
Enter fullscreen mode Exit fullscreen mode

and un comment it

TURNSERVER_ENABLED=1
Enter fullscreen mode Exit fullscreen mode

and save the file and start the server and thats it

systemctl start coturn
Enter fullscreen mode Exit fullscreen mode

that's it now you have started the CoTURN and you are running it

Step 4: Testing The TURN server

You can easily test your TURN server on Trickle ICE. You can go to the trickle ice website

add your credentials and click on the add server button to add your TURN server

Step 5: Estimating Costs and Instance Sizes required

A 720p video call required 2 Mbps bandwidth per participant. Even if you have a fairly small TURN server usage then you would consume around ~150GB of bandwidth each month.

TURN servers can be used for the DDoS amplification attack, hence TURN server are prone to DDoS attack.

If you are running on azure you need to purchase DDoS protection which can run into thousands of dollars

If we assume 150GB bandwidth then lets calculate the cost for each of the services:

Image description

Metered TURN Server

150 GB TURN Usage every month then the Growth Plan from Metered TURN Server would suffice. 150GB of usage in included in the plan, the plan costs $99/mo.

AZURE TURN Server

Azure offers 100GB of free bandwidth every month. To run the TURN Server you would require at least a A3: 4 core 7 GB RAM = 175/mo.

Open Relay Project

If you are looking for a free turn server, then Open Relay Project is a good option

It provides 50 GB of TURN server usage every month. which is good enough for small to medium sized projects

It is production ready with 99.999% uptime and offers STUN as well as TURN usage

List of Costs Metered TURN Server AZURE TURN server Comment
Instance Costs Included in Price A3: (4 core, 7 GB ram,) $0.24 /hr Encrypted data transfer requires fair amount of CPU and RAM usage
Reliability 99.999% unknown (instance can go into limbo) Cloud severs can some times go into limbo and needs to be restarted
Bandwidth 0.4 /GB and 0.1 /GB with volume discounts 100 GB free /mo af that 0.05 /GB As usage increases you might require more CPU and RAM and thus a bigger instance
DDoS Protection Included in Price Starting from 1000s of dollars TURN Servers are also prone to DDoS attack, because the attackers uses the TURN/STUN Server for DDoS amplification attacks
Maintenance Maintenance Free Maintenance required Updating the Operating System and other dependencies is required from time to time
Total Cost / mo 99 USD (150 GB comes included) 175 USD /mo The price is for instance costs and bandwidth usage for 150 GB TURN usage / mo

Bonus: Considerations when running TURN server on Azure

There are a few considerations when running your own TURN server on Azure as compared to using the Metered TURN server

  • Expensive to run
  • Protection against DDoS Attacks
  • No geo targeting
  • Maintenance
  • Scalability

Expensive to Run

Azure TURN server is expensive to run because instance costs as well as bandwidth considerations are quite high with uncertain costs

Metered gives you full control over costs as you can determine how much to spend or you want to spend for overages or not

Protection against DDoS attacks

Azure offers DDoS protection as an add-on that costs quite a lot of money. With Metered TURN server DDoS protection comes bundled with the plan and basically you don't have to worry about attacks or anything like that

No Geo targeting

With Azure you can technically create servers with geo targeting but that would be very expensive because you will need to create and maintain multiple servers across the globe that would cost quite a lot of money

Metered offers automatic geo targeting for free and is included in every plan

Maintenance

With Azure you just get a server that you will have to maintain and update all the dependencies. The instance can also go into limbo which is a state where the instance stops working and needs to be restarted which results in downtime

With Metered you don't need to worry about maintenance at all. There is a 99.999% Uptime which is best in the industry

Scalability

The Azure TURN server is limited by the instance that you created. As TURN usage increase you will require bigger and bigger instance.

During peak times you might hit the limit of the instance and might need to create a bigger instance that might increase costs

Metered TURN server is highly scalable and there is no need to worry about scalability at all

Conclusion

In this article we learnt about how to create a TURN server using Azure. We also learnt about the paid TURN server service called Metered and how you can use that as an alternative to creating a TURN server on Metered.

Note: This article was originally written on the Metered Blog: Azure TURN Server: The Step by Step Guide.

Top comments (0)