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 Global TURN servers

  1. API: TURN server management with powerful API. You can do things like Add/ Remove credentials via the API, Retrieve Per User / Credentials and User metrics via the API, Enable/ Disable credentials via the API, Retrive Usage data by date via the API.
  2. Global Geo-Location targeting: Automatically directs traffic to the nearest servers, for lowest possible latency and highest quality performance.
  3. Servers in 12 Regions of the world: Toronto, Miami, San Francisco, Amsterdam, London, Frankfurt, Bangalore, Singapore,Sydney
  4. Low Latency: less than 50 ms latency, anywhere across the world.
  5. Cost-Effective: pay-as-you-go pricing with bandwidth and volume discounts available. 50 GB/mo free in the free plans. $0.40 USD/ GB to $0.10 USD/ GB with volume discounts
  6. Easy Administration: Get usage logs, emails when accounts reach threshold limits, billing records and email and phone support.
  7. Standards Compliant: Conforms to RFCs 5389, 5769, 5780, 5766, 6062, 6156, 5245, 5768, 6336, 6544, 5928 over UDP, TCP, TLS, and DTLS.
  8. Multi‑Tenancy: Create multiple credentials and separate the usage by customer, or different apps. Get Usage logs, billing records and threshold alerts.
  9. Reliability: 99.999% Uptime with SLA.
  10. Enterprise Scale: : With no limit on concurrent traffic or total traffic. Metered TURN Servers provide Enterprise Scalability

You can create an account on Metered website and get 50GB of Free TURN usage every month

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

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

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

and

sudo apt-get upgrade

then install the free turn server Coturn

sudo apt-get install coturn
  • Set the coturn to start automatically when the instance starts

go to file etc/default/coturn

and edit the file using

sudo namo /etc/default/coturn

and un comment this

TURNSERVER_ENABLED=1

and save the file and start the server and thats it

systemctl start coturn

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:

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 Maintanence Free Maintanence required Updating the Oprating System and other dependiencies 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

You might be interested in some of our other articles

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