Open-source TURN/STUN server

Self-hosted Coturn TURN server on AWS and Google Cloud

Run your own Coturn TURN and STUN server from a pre-configured image, so WebRTC and VoIP calls still connect behind strict NATs and firewalls. Media is relayed by a server in your own cloud account, with no per-minute relay fees.

  • SSL with Let's Encrypt
  • Runs in your own account
  • No usage fees
Coturn TURN server deployed on Google Cloud by Meetrix

What is Coturn?

Coturn is an open-source TURN and STUN server. STUN helps two devices discover their public address so they can connect directly. When a restrictive NAT or corporate firewall makes that impossible, TURN relays the media between them. Without a TURN server, those users simply get a failed call.

What's in the Meetrix Coturn image

A manual Coturn setup means firewall rules, SSL certificates, credential settings and tuning turnserver.conf. The marketplace image ships with all of that done and tested.

How to set up a self-hosted TURN server

  1. Launch the server

    Subscribe on AWS Marketplace or Google Cloud Marketplace and enter your domain, admin email, TURN realm and a strong static auth secret.

  2. Point your domain at it

    Create a DNS A record for your TURN domain with the server's public IP, and wait for it to propagate.

  3. Generate the certificate

    On AWS this happens automatically for Route 53 domains. Otherwise SSH in, run the certificate script and restart Coturn.

  4. Test and connect

    Generate test credentials from your secret, check them in the Trickle ICE tool, then add the TURN URLs to your WebRTC app.

Choose your cloud

Coturn server ports and requirements

These are the firewall rules the Google Cloud image sets up. If calls fail to relay, check that the UDP relay range is open.

ServicePortsProtocol
STUN / TURN3478UDP and TCP
TURN over TLS (TURNS)5349TCP
Media relay range49152-65535UDP
Let's Encrypt HTTP challenge80TCP
SSH (administration)22TCP

Server size: t3.micro on AWS or e2-small (2 GB RAM) on Google Cloud handles most setups. Choose a larger machine for high-traffic production use.

Coturn by Meetrix vs Twilio vs Xirsys

Coturn by MeetrixTwilio Network TraversalXirsys
HostingYour AWS account or GCP projectTwilio's cloudXirsys cloud infrastructure
Data controlMedia never leaves your accountTwilio relays your mediaXirsys relays your media
Pricing modelCloud compute only, no usage feesPer-minute relay billingPer-GB bandwidth billing
Data residencyAny region you chooseTwilio data processing appliesXirsys data processing applies

Hosted TURN services are quick to start but bill for every relayed minute or gigabyte. Read the full Coturn on Google Cloud comparison →

Video: deploy Coturn on AWS

Coturn FAQ

What is a TURN server and do I need one?

A TURN server relays WebRTC media when two peers cannot connect directly, usually because of a restrictive NAT or corporate firewall. Without one, those users get a failed call with no clear error. If your app uses WebRTC, you need one.

What is the difference between STUN and TURN?

STUN only helps two peers find their public IP and port so they can try a direct connection. TURN relays the actual media when that direct connection is not possible. It uses more bandwidth, but works on almost any network.

Which ports does Coturn need?

Port 3478 over UDP and TCP for STUN and TURN, TCP 5349 for TURN over TLS, and the UDP relay range 49152-65535. Keep TCP 80 open for the Let's Encrypt challenge and TCP 22 if you want SSH access.

Can I use this Coturn server with Jitsi Meet?

Yes. Coturn is the most widely used TURN server in the Jitsi ecosystem. Point your Jitsi Meet configuration at the server's TURN URL and static auth secret.

Can I use my own domain?

Yes, and you should. You enter the domain at launch, point a DNS A record at the server and generate a Let's Encrypt certificate for it.

How do I rotate the TURN authentication secret?

Edit static-auth-secret in /etc/turnserver.conf, then restart Coturn with sudo systemctl restart coturn.

How do I renew the SSL certificate?

Let's Encrypt certificates expire every 90 days. Run sudo certbot renew and restart Coturn, or set up a cron job to renew automatically.

Can it handle high traffic?

Yes. Move to a larger machine type, or run several Coturn instances in parallel for high availability. Meetrix can help design the right setup for your traffic.

Coturn guides and articles

Need a hand with your TURN server?

Our WebRTC engineers build and run real-time communication infrastructure every day, from TURN setup to Jitsi integration. Tell us what you need.

Contact us