AI, LLM and real-time · WebRTC · LiveKit

Real-time video and voice for iOS and Android with LiveKit on AWS

A WebRTC platform for mobile apps built on the LiveKit SFU: token-based access, UDP and TURN/TLS connectivity, server-side recording to S3, webhooks, ingress for streams and scaling across nodes and regions.

A reference architecture from EITSAA, not a named client system. Service limits, prices and product features change, so confirm current details before you commit to a design.

  • ACSC Essential Eight
  • Australian Privacy Principles (APP 11)
  • Sydney (ap-southeast-2) hosting option

Architecture

Architecture diagram. Tinted boundaries show regions, accounts, networks and trust zones. Numbered arrows match the flow below.
Real-time video and voice for iOS and Android with LiveKit on AWS architectureiOS and Android apps to Route 53: DNS. iOS and Android apps to Token service: HTTPS, get JWT. iOS and Android apps to Network Load Balancer: WebRTC UDP / TURN TLS. Network Load Balancer to LiveKit SFU on EKS: forward. LiveKit SFU on EKS to ElastiCache Redis: route. LiveKit SFU on EKS to LiveKit Egress: record. LiveKit Egress to S3 recordings: MP4 / HLS. LiveKit SFU on EKS to Webhook receiver: webhooks. LiveKit Ingress to LiveKit SFU on EKS: publishMobile clientsAWS account · ap-southeast-2 (self-hosted LiveKit)VPC · EKS clusteriOS and Android appsLiveKit Swift and Kotlin SDKsRoute 53Latency or geo recordsToken serviceLambda, Cognito auth, JWTNetwork Load BalancerTCP 443 TLS, UDP 3478LiveKit SFU on EKSOne pod per node, host networkElastiCache RedisRoom and node routingLiveKit EgressRoom and track recordingS3 recordingsSSE-KMS, lifecycleWebhook receiverAPI Gateway, Lambda,EventBridgeLiveKit IngressRTMP and WHIP into rooms1DNS2HTTPS, get JWT3WebRTC UDP / TURN TLS4forward5route6record7MP4 / HLS8webhooks9publishPlatform servicesAWS IAMAmazonCloudWatchAWS CloudTrailAWS KMS
  • People and clients
  • Network and edge
  • Security and identity
  • Real-time media and voice
  • Databases and data
  • Object and file storage
  • Messaging, events and workflow
  • Monitoring, audit and analytics
  • Request or data flow
  • Asynchronous or optional
  • Boundary: region, account, network or trust zone

Request and data flow

  1. The app resolves the regional LiveKit hostname. Latency-based records in Route 53 steer users to the nearest healthy cluster.

  2. The user authenticates to your backend (Cognito or your IdP). The token service checks business rules, then mints a short-lived LiveKit access token (JWT) with grants for one room: join, publish, subscribe, and any recorder or admin rights.

  3. The SDK connects with the token over WebSocket signalling and negotiates media. UDP is preferred. If networks block it, ICE falls back to TCP and to TURN over TLS on 443, which passes most corporate and mobile carrier firewalls.

  4. The load balancer forwards to LiveKit nodes. Nodes are exposed with host networking and a public IP each, because media flows directly between client and node and does not benefit from a layer 7 proxy.

  5. Nodes register in Redis so any node can find the node that owns a room, and so autoscaling can add capacity without downtime.

  6. A recording request (room composite or per-track) starts Egress workers that join the room as a hidden participant and render video with headless Chrome or write tracks directly.

  7. Egress uploads MP4, HLS or track files to S3, using a task role scoped to the recordings prefix.

  8. LiveKit posts webhooks (room started, participant joined, egress ended) to a receiver that verifies the signature and publishes events to EventBridge for billing, notifications and post-processing.

  9. Ingress accepts RTMP or WHIP streams from encoders and publishes them as participants, which is useful for broadcasts or hardware cameras.

Components and why they were chosen

ComponentWhat it doesWhy this choice
LiveKit server (open-source SFU)Selective forwarding of audio and video with simulcast, dynacast and data channels.An SFU scales to many participants per room, unlike a mesh, and costs less than an MCU that mixes on the server.
Amazon EKS with managed node groupsRuns LiveKit, Egress and Ingress with the official Helm charts.Rolling node upgrades and autoscaling. Use compute-optimised instances with good network throughput.
Network Load BalancerTLS on 443 for TURN and signalling, UDP for STUN and TURN.Layer 4 keeps latency low. Media typically uses node public IPs, with the NLB handling signalling and TURN.
Token service (Lambda, Cognito)Authorises users and issues scoped JWTs with the LiveKit API key and secret.The API secret never reaches the app. Tokens are short-lived and room-scoped.
ElastiCache for RedisShared state for multi-node routing, and for Egress and Ingress job queues.Required when you run more than one node.
LiveKit Egress and IngressRecording, composite layouts, streaming out and RTMP or WHIP in.Runs as separate scalable services so media forwarding is not slowed by encoding.
S3 with KMSRecording storage with lifecycle to colder tiers and deletion for retention.Durable and cheap, and recordings are personal information that need retention rules.
EventBridge and LambdaWebhook fan-out for notifications, billing and analytics.Decouples your business logic from the media plane.

Design decisions and trade-offs

Self-host or LiveKit Cloud

Start on LiveKit Cloud for speed, self-host on EKS when you need data control, cost at scale or an Australian-only footprint.

Why. Cloud removes the hard parts: global edge, scaling and TURN operations.

Trade-off. Self-hosting makes you responsible for UDP networking, capacity planning and upgrades.

Media topology

SFU with simulcast and adaptive streams.

Why. Each client uploads once and receives only the quality its bandwidth supports.

Trade-off. Higher server egress than peer-to-peer, but reliable for more than two participants.

Connectivity

UDP first with TURN over TLS 443 as the fallback.

Why. Mobile and corporate networks often block UDP.

Trade-off. TURN relays media through your servers and adds bandwidth cost for those users.

Node layout

One LiveKit pod per node with host networking and a dedicated node pool.

Why. Avoids NAT and kube-proxy overhead on UDP and keeps CPU predictable.

Trade-off. Less bin-packing and higher idle cost than shared nodes.

Regions

Independent clusters per region with geo or latency routing, one room lives on one cluster.

Why. Latency is dominated by distance to the SFU.

Trade-off. Participants far from the room's region get worse latency. Check LiveKit's current cross-region options if you need them.

Well-architected pillars

Security

Short-lived room-scoped JWTs, DTLS-SRTP media encryption, secrets in Secrets Manager, security groups limited to required ports and private Redis.

Reliability

Multiple nodes across AZs, health checks and graceful draining on deploy. Clients reconnect automatically and can resume.

Performance

Bandwidth, not CPU, is usually the first limit. Use simulcast, dynacast and appropriate instance network performance, and load test with the LiveKit load tester.

Cost optimisation

Data transfer out dominates. Recording, TURN relays and egress rendering add compute and transfer.

Operational excellence

Helm and Terraform, Prometheus metrics from LiveKit, node-pool autoscaling on CPU and participants, and a rehearsed upgrade procedure.

Sustainability

Scale node pools down off-peak, record only when required and apply retention policies to recordings.

Network, identity and data

Networking

Public subnets for media nodes (each needs a reachable address), private subnets for Redis, Egress and Ingress. Open UDP for the configured media port range (or a single muxed port), TCP 7881 for ICE over TCP, and 443 and 3478 for TURN, with security groups restricting everything else. Check the current LiveKit deployment guide for exact ports.

Identity and least privilege

Your IdP or Cognito authenticates the user. The token service authorises each room join. LiveKit API keys live only in the token service and the server. Egress writes to S3 with an IRSA role limited to one prefix.

Data and encryption

Audio and video are personal information, and recordings can contain sensitive conversations. Notify participants and capture consent where recording, encrypt with KMS, set retention, and restrict access to the recordings bucket. Media is end-to-end encrypted hop by hop, not between participants, unless you enable LiveKit's end-to-end encryption.

Security and compliance mapping

ControlHow this design addresses it
Restrict administrative privilegesNo static keys on nodes, IRSA roles and scoped token grants. Essential Eight.
Patch applications and operating systemsManaged node groups and a regular LiveKit upgrade cadence. Essential Eight.
Collection and consentRecording notices and consent support APP 3 and APP 5.
Security of personal informationEncryption, retention and access logging support APP 11.

Mappings show how the design supports each control. They are not certifications, and EITSAA does not claim IRAP assessment or compliance for any reference architecture.

Failure modes, targets and scaling

  • Target RTOMinutes for a node, under an hour to rebuild a cluster from IaC
  • Target RPONot applicable to live media. Recordings are written continuously and can lose the last segment in a crash
  • Scaling and limitsPer-node capacity depends on instance size, codecs and layout, so measure with a load test. A single room is bounded by one node's resources.
Failure modeMitigation
Node failure mid-callClients reconnect and rejoin. Design the app UI to show reconnecting state.
UDP blocked on the user's networkICE fallback to TCP and TURN over TLS 443.
Capacity exhausted during a peakAutoscale on CPU and participant count with headroom, and use node selection that avoids new rooms on hot nodes.
Recording job failsWebhook on egress_ended with status, retry policy and alarms on failed egress.

Observability and runbooks

  • LiveKit Prometheus metrics: rooms, participants, packet loss, jitter, node CPU and bandwidth.
  • Client-side analytics from the SDKs: connection quality, reconnects and TURN usage.
  • Alarms on failed egress, token errors and node saturation, with a call quality runbook.

Cost drivers and levers

EC2 compute and network egress for media, TURN relayed traffic, Egress rendering and S3 storage.

  • Use simulcast and cap maximum resolution.
  • Prefer audio-only where video is not needed.
  • Record tracks rather than composites when you can.
  • Scale node pools to the daily pattern.

Implementation and fit

Phased approach

  1. Prototype on LiveKit Cloud with the mobile SDKs and the token service.
  2. Add recording, webhooks and analytics.
  3. Load test and decide self-host or stay on Cloud using measured cost.
  4. If self-hosting, build the EKS platform in one region, then add regions.

Anti-patterns to avoid

  • Putting the API secret in the mobile app.
  • Relying on UDP only.
  • Running the SFU behind a layer 7 proxy.
  • Recording without consent or retention rules.

When to use it

  • Telehealth, tutoring, field support and live collaboration inside a mobile app.
  • Products that need control over media, recording and branding.

When not to

  • Simple one-to-one calls where a managed CPaaS is cheaper than running infrastructure.
  • Regulated recordings with no retention and consent process.

More in ai, llm and real-time

Related insights

Discuss this architecture

Tell us your systems, constraints and timeline. We reply within one business day, and the initial conversation is free.