LiveKit Logo



Deployment / Deploy to a VM

Deploy to a VM

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


To start, you'll need:

  • A valid self-generated LiveKit API key, following the instructions in the Getting Started guide.
  • A valid SSL certificate issued by a certificate authority (self-signed certs do not work here).
  • 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:


  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.


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


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 [email protected]
tail /var/log/nginx/access.log
tail /var/log/nginx/error.log

Instance started before networking

When using cloud-init, it's possible that the instance started up before networking was available to the machine. This is commonly the case on EC2 instances. When this happens, your cloud-init scripts will be stuck in a bad state. To fix this, you can SSH into the machine and trigger a re-run:

sudo cloud-init clean --logs
sudo reboot now