DEV Community

Cover image for How to run MoQ in AWS for sub-second live streaming at scale
Amar Thodupunoori for Ant Media

Posted on

How to run MoQ in AWS for sub-second live streaming at scale

For years you had to pick one. Real-time latency, or an audience of any size. Media over QUIC gives you both, and you can have it running on an AWS instance this afternoon — publisher, relay and player included.

Why MoQ exists

Until now you picked one of two compromises. WebRTC gave you sub-second latency but no CDN — every viewer is a peer connection, and scaling means an SFU and a lot of servers. LL-HLS gave you CDN scale but four seconds or more of delay, which kills anything interactive.

MoQ removes the choice. It runs on QUIC, so a delayed frame does not block the ones behind it, and it uses WebTransport so it works straight from the browser with no plugin. The result is sub-second latency with a pub/sub delivery model a CDN can actually cache. Cloudflare already runs MoQ at their edge in alpha, so the CDN half is not theoretical.

MoQ compared with WebRTC and LL-HLS across latency, architecture and browser support.


Dimension   MoQ WebRTC  LL-HLS
Latency Sub-second, configurable    0.2–0.5s  4+ seconds
Architecture    Pub/sub + CDN relay SFU CDN / origin
CDN cacheable   Yes No  Yes
Transport   UDP / QUIC / WebTransport   UDP / DTLS-SRTP HTTP
Browser support Chrome, Edge, Safari 26.4+  All major browsers  All major browsers
Enter fullscreen mode Exit fullscreen mode

Source: WebRTC vs MoQ — two protocols, one platform

Running it on AWS

By the end of this you will be publishing from a browser and watching it back less than a second later. There is nothing to compile, and the server issues its own domain and certificate — you do not need to own either. Playback works in Chrome, Edge and Brave, or Safari 26.4 and above.

1. Launch the instance
Subscribe on AWS Marketplace and launch. A c5.xlarge is plenty to start. The AMI arrives with Ant Media Server 3.0.3 already running and every port it needs already open.

Launch the AMI

2. Add port 4443 to the security group
One rule to add, on both TCP and UDP. That is where the MoQ relay listens. Everything else the server needs is already open on the AMI.

Add the UDP rule as well as TCP. With only TCP the pages load normally and the browser then silently never reaches the relay — it is the most common first-run failure.

3. Turn on SSL from the web panel
MoQ uses WebTransport, and browsers only allow that over HTTPS. You do not need to own a domain — the server will give you a free one.

Open the web panel at http://your-server-ip:5080 — that is HTTP on port 5080, which is how the server starts before SSL exists. Go to Settings → SSL, set Type to Subdomain of antmedia.cloud and click Activate.

A subdomain is allocated to you, a Let’s Encrypt certificate is issued and installed, and the server restarts itself. From then on it answers on https://your-subdomain.antmedia.cloud:5443.

SSL

4. Install the MoQ plugin
The plugin is a single release archive. You can download MoQPlugin-release.zip to your own machine and upload it, but the curl command below is easier — it pulls the file straight onto the server, so there is nothing to transfer.

SSH in as ubuntu and run these in order:

# fetch the plugin release onto the server
curl -L "https://drive.usercontent.google.com/download?id=1X9ymWsDjfdNdcXH2h0y2Ak2IWpmnkijk&export=download&confirm=t" -o MoQPlugin-release.zip

# unpack it and step into the folder
unzip MoQPlugin-release.zip
cd MoQ-Plugin

# make the installer executable, then run it
chmod +x install-moq-plugin.sh
sudo ./install-moq-plugin.sh

# put the browser publisher and player into your application
sudo mkdir -p /usr/local/antmedia/webapps/live/moq
sudo cp -r moq-ams-player-build/* /usr/local/antmedia/webapps/live/moq

# restart so the server loads the plugin
sudo service antmedia restart
Enter fullscreen mode Exit fullscreen mode

Publish, and watch it back

Two pages are now live on your server. Replace your-subdomain with the address the server allocated you in step 3 — everything after the domain stays exactly as written.

1 · Open the publisher
Enter a stream ID, choose Camera as the source, and hit Start Publishing.
https://your-subdomain.antmedia.cloud:5443/live/moq/play.html

MOQ publisher

Status flips to publishing, and the relay URL on port 4443 appears at the top alongside the broadcast path.

2 · Open the player in a second window
Enter the same stream ID and pick the source track. The debug panel underneath reports what you are actually getting — frame rate, buffer, stalls and glass-to-glass latency.
https://your-subdomain.antmedia.cloud:5443/live/moq/play.html

MOQ Player

source is the original quality as published. If you switch on adaptive bitrate streaming, each rendition the server produces appears here as its own MoQ track — 720p, 480p and so on.

What is running now

  • Browser publishing and playback at sub-second latency
  • An embedded moq-lite relay listening on port 4443
  • Every adaptive rendition exposed as its own MoQ track
  • Any moq-lite client able to publish straight to the relay

What you can add to it

  • RTMP, RTSP or SRT in the front, MoQ out the back
  • The same stream over WebRTC, HLS and DASH simultaneously
  • Recording, transcoding and control from the REST API
  • Cloudflare’s MoQ edge in place of the embedded relay

Before you build production on it. MoQ is still being standardised. This plugin implements moq-lite, a deployable subset that already interoperates with full moq-transport CDNs including Cloudflare’s. It is functional and actively maintained — for a serious integration, start in staging and talk to us.

Why run it on AWS specifically

MoQ is a transport. You still need somewhere to ingest, transcode and record — and something that speaks RTMP and RTSP for the sources that will never speak QUIC.

Running it on an AWS instance means the MoQ relay, the media server and the rest of your pipeline sit in one place, on infrastructure you already have committed spend on, and it is licensed per instance-hour rather than per stream or per viewer.

  • Single instance, single hourly rate, no per-stream or per-viewer fees
  • Auto-managed deployment for one server, CloudFormation for a multi-node cluster
  • Draws down against committed AWS spend
  • Everything stays inside your own account and VPC

Measured on one c5.xlarge

Ant Media Server throughput measured on a single AWS c5.xlarge instance.

Workload Capacity
RTSP camera streams, video only,360p 550
WebRTC publishers, 1080p 35
WebRTC viewers, 1080p 105
RTMP ingest, 1080p 35
SRT ingest, 1080p 42

Sustained at 65–75% CPU. Each figure measured on its own — publish and playback were not run concurrently.

Try it on AWS

Launch, add one port, activate SSL, paste one command. Publisher and player included. Would rather not do the setup? Tell us what you are building and we will deploy the first one for you, free.

Start Free on AWS
7-day free trial · billed per instance-hour · cancel any time

Top comments (0)