New version available! (v2.5.3)
SRT Server

Docs/Intercom

TURN server.

WebRTC needs an external relay when operators use 4G/5G with CGNAT. With Amazon Lightsail, Docker and coturn you're up in 15 minutes for under $5 a month.

  • Ubuntu 22.04 LTS
  • Docker
  • coturn 4.6.3
  • Port 3478
  • ~$3.50–5/month

Six steps · 15 minutes

  1. 01

    Create the instance in Amazon Lightsail

    Choose the $3.50–5/month plan (512 MB–1 GB RAM is enough) and «OS Only → Ubuntu 22.04 LTS». Attach a static IP to the instance: the app needs it fixed.

  2. 02

    Open the ports in the Lightsail firewall

    In the instance's «Networking» tab add these rules:

    3478        TCP + UDP   # STUN / TURN
    49152-65535 UDP         # WebRTC media relay
  3. 03

    Install Docker

    Connect via SSH and install Docker with the official script:

    curl -fsSL https://get.docker.com | sh
    sudo usermod -aG docker $USER && newgrp docker
  4. 04

    Generate the secret in the App

    In Intercom, «Cameras and groups» tab, «TURN server» card: type the instance's static IP, click «Generate secret» and then «Copy coturn command». The secret never leaves your PC: phones get temporary credentials that renew by themselves.

  5. 05

    Paste the command on the instance

    Open the Lightsail SSH console and paste the copied command (it looks like this; always use the App's, which has your IP and secret). It uses coturn 4.6.3: the latest version does not answer over UDP.

    P=$(hostname -I | awk '{print $1}')
    A='--realm=intercom.srtserver.app --use-auth-secret --static-auth-secret=xxxxxxxx'
    A="$A --listening-ip=$P --relay-ip=$P --external-ip=203.0.113.10/$P"
    A="$A --listening-port=3478 --min-port=49152 --max-port=65535"
    A="$A --relay-threads=0 --no-tls --no-dtls --fingerprint --log-file=stdout"
    sudo systemctl disable --now coturn 2>/dev/null
    docker pull coturn/coturn:4.6.3 && docker rm -f coturn
    docker run -d --name coturn --restart always --network host coturn/coturn:4.6.3 $A
    sleep 3; docker ps --format '{{.Names}} {{.Image}} {{.Status}}' | grep coturn
  6. 06

    Test it from the App

    Click «Test TURN». If it says «TURN works», operators on 4G/5G can connect: they get the configuration by themselves when they open their link.