Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to create stun turn server instance using AWS EC2

Tags:

Actually i wants to use my own stun/Turn server instance and i want to use Amazon EC2 .If anybody has any idea regarding this please share with me the steps to create or any reference link to follow.

like image 990
satya Avatar asked Jul 01 '15 12:07

satya


People also ask

How do I create an EC2 instance?

Open the Amazon EC2 console at https://console.aws.amazon.com/ec2/ . Choose Launch Instance. In Step 1: Choose an Amazon Machine Image (AMI), find an Amazon Linux 2 AMI at the top of the list and choose Select. In Step 2: Choose an Instance Type, choose Next: Configure Instance Details.

What is an EC2 instance in AWS?

An EC2 instance is nothing but a virtual server in Amazon Web services terminology. It stands for Elastic Compute Cloud. It is a web service where an AWS subscriber can request and provision a compute server in AWS cloud.

What is TURN server on Amazon EC2?

The TURN Server is a VoIP media traffic NAT traversal server and gateway. It can be used as a general-purpose network traffic TURN server and gateway, too. Here, I am going to explain you the steps of installing and configuring turn server on Amazon EC2.

How to create an instance in AWS?

Click on 'Launch Instance' button in the section of Create Instance (as shown below). Instance creation wizard page will open as soon as you click 'Launch Instance'. You will be asked to choose an AMI of your choice. (An AMI is an Amazon Machine Image.

How to install coturn on EC2?

do an ssh login to your ec2 instance, then run the below commands for installing and starting the turn server. simple way: sudo apt-get install coturn If you say no, I want the latest cutting edge, you can download source code from their downloads pagein install it yourself, example:


2 Answers

do an ssh login to your ec2 instance, then run the below commands for installing and starting the turn server.

simple way:

sudo apt-get install coturn 

If you say no, I want the latest cutting edge, you can download source code from their downloads page in install it yourself, example:

sudo -i     # ignore if you already in admin mode apt-get update && apt-get install libssl-dev libevent-dev libhiredis-dev make -y    # install the dependencies wget -O turn.tar.gz http://turnserver.open-sys.org/downloads/v4.5.0.3/turnserver-4.5.0.3.tar.gz     # Download the source tar tar -zxvf turn.tar.gz     # unzip cd turnserver-* ./configure make && make install  

sample command for running TURN server:

turnserver -a -o -v -n -u user:root -p 3478 -L INT_IP -r someRealm -X EXT_IP/INT_IP  --no-dtls --no-tls 

command description:

  • -X - your amazon instance's external IP, internal IP: EXT_IP/INT_IP
  • -p - port to be used, default 3478
  • -a - Use long-term credentials mechanism
  • -o - Run server process as daemon
  • -v - 'Moderate' verbose mode.
  • -n - no configuration file
  • --no-dtls - Do not start DTLS listeners
  • --no-tls - Do not start TLS listeners
  • -u - user credentials to be used
  • -r - default realm to be used, need for TURN REST API

in your WebRTC app, you can use trun server like:

{     url: 'turn:user@EXT_IP:3478',     credential: 'root' } 
like image 127
mido Avatar answered Oct 02 '22 04:10

mido


One method to install a turnserver on Amazon EC2 would be to choose Debian and to install the coturn package, which is the successor of the RFC5766-server.

The configuration file at /etc/turnserver.conf includes EC2 specific instructions. The information provided within this file is very exhaustive in general and should answer the majority of configuration questions.

Once configured, the coturn server can be stopped an started however you would any other service.

like image 32
Mantriur Avatar answered Oct 02 '22 04:10

Mantriur