Running LiveKit on AWS
It’s now been a few months since we launched LiveKit, and we’ve noticed getting up and running can be tricky if you don’t have Kubernetes set up. While deploying on Kubernetes using Helm remains the robust path for production deployments, we wanted an easier way to get started with LiveKit.
Thus, we’ve put together a Cloud-Config template which renders a fully-functional, LiveKit server deploy, only a few steps beyond launching an EC2 instance. Here’s how to get going:
- Generate your LiveKit API key and secret, following the docs: https://docs.livekit.io/guides/getting-started#generate-api-key-and-secret
- Acquire a domain name and purchase an SSL certificate. For example, you can use AWS Route 53 to register and manage your domain (example-domain.com), and Namecheap to purchase an SSL certificate for your desired subdomain (livekit.example-domain.com).
- Download the raw LiveKit cloud-init Cloud-Config template for Ubuntu: https://github.com/livekit/livekit-server/blob/master/deploy/cloud-init.ubuntu.yaml
- Edit the Cloud-Config template:
- Fill in the API key and secret with the ones you generated in step 1
- Paste your SSL certificate and key from step 2
- From the AWS EC2 Console, launch an instance. Choose the latest Ubuntu Server AMI, along with your desired instance type.
- Paste your edited Cloud-Config template into the User data field, under the Advanced Details section.
- In the Configure Security Group section, make sure to allow the following ports to your LiveKit Server instance:
- TCP 22
- TPC 443
- TCP 7880
- TCP 7881
- UDP 7882
- Launch your LiveKit Server instance.
- Create an A record on your domain, pointing from your desired subdomain (livekit.example-domain.com) to the public address for your instance.
- Done! For completeness:
- Use the LiveKit Connection Tester to make sure everything is working properly.
- Generate a token using your desired method, and the “LiveKit URL” will look something like this: wss://livekit.example-domain.com. You can join a chat on your own LiveKit Server instance, using our React Example app.
Should something go wrong, you can log in to your LiveKit instance with SSH. Here are some helpful troubleshooting commands:
systemctl status docker.service systemctl status nginx.service systemctl status email@example.com tail /var/log/nginx/access.log tail /var/log/nginx/error.log
For other simple deployment options, including deployment to Digital Ocean, and building a custom AMI, see the LiveKit deployment guide.
As always, don’t hesitate to send us a GitHub PR with any improvements, or ask questions in our community Slack workspace.