Skip to main content

Deploy to a VM

This guide helps you to set up LiveKit server on a virtual machine on AWS EC2 or Digital Ocean.

Pre-requisites

To start, you'll need:

  • A valid self-generated LiveKit API key, following the instructions in the Getting Started guide.
  • A valid SSL certificate and private key, which can be purchased anywhere that sells SSL certificates such as Namecheap.
  • Ability to add a DNS record pointing to your new LiveKit Server.

Deploy with Cloud Init

This is the easiest method for deploying LiveKit Server. You can deploy a LiveKit Server using a vanilla Linux image and Cloud Init configuration file.

LiveKit Server can be deployed with either Amazon Linux 2 or Ubuntu. Use the cloud-init.<platform>.yaml file corresponding to your desired platform:

Steps:

  1. Download one of the above cloud-init.<platform>.yaml files. Edit it to include your LiveKit Server configuration, SSL certificate, and SSL private key.
  2. Open the AWS Console and navigate to EC2.
  3. Launch an instance.
  4. Choose the latest "Amazon Linux 2" or "Ubuntu Server" AMI.
  5. In the "Step 3: Configure Instance Details" screen, copy and paste text from your modified cloud-init.yaml file from step 1 into the "User data" field, under the "Advanced Details" section.
  6. Launch your instance as usual.

Firewall

In addition to the required ports listed above, you'll also want to open up the following ports:

  • TCP 22 - SSH
  • TPC 443 - SSL terminated WebSocket
  • UDP 7882 - RTC UDP

Troubleshooting

If something is not working as expected, SSH in to your server and use the following commands to investigate:

systemctl status docker.service
systemctl status nginx.service
systemctl status docker.livekit-server@v0.13.service
tail /var/log/nginx/access.log
tail /var/log/nginx/error.log