LiveKit docs › Manage & Deploy › Agent deployment › Private Links › Set up on AWS

---

# Set up a private link on AWS

> Connect a deployed LiveKit agent to a private service in your AWS network using AWS PrivateLink.

## Overview

This guide shows how to set up a private link on AWS, connecting a deployed LiveKit agent to a private service in your AWS network over AWS PrivateLink. To learn more, see [Private Links](https://docs.livekit.io/deploy/agents/private-links.md).

You expose your service in AWS, then create the private link with the [LiveKit CLI](https://docs.livekit.io/reference/developer-tools/livekit-cli.md#install-the-cli).

## Prerequisites

Before you begin, make sure you have the following:

- A LiveKit Cloud project [linked to the LiveKit CLI](https://docs.livekit.io/reference/developer-tools/livekit-cli.md#add-a-project).
- A [deployed agent](https://docs.livekit.io/deploy/agents.md) in a [supported LiveKit region](https://docs.livekit.io/deploy/agents/private-links.md#providers-regions).
- AWS permissions to create endpoint services and approve connection requests.
- An [AWS Network Load Balancer (NLB)](https://docs.aws.amazon.com/elasticloadbalancing/latest/network/create-network-load-balancer.html) in front of your service, with healthy targets.
- The TCP port your agent needs to reach. This is the port configured for your NLB listener.

Your NLB must meet the following requirements:

- A listener for the required TCP or TLS port.
- A target group whose targets are all healthy.
- At least two Availability Zones.
- A subnet in the [supported Availability Zone](https://docs.livekit.io/deploy/agents/private-links.md#providers-regions) for the AWS region of your endpoint service. If your targets are in other Availability Zones, turn on [cross-zone load balancing](#stuck-provisioning).
- Security groups and network ACLs that permit the expected traffic.

### Find the supported zone name

AWS maps Availability Zone names, such as `us-east-1a`, to Availability Zone IDs differently for each account, so the same name can be a different zone in your account. The supported zone for each region is an ID, such as `use1-az1`. To find the name that maps to the supported ID for your region, run the following command:

```shell
aws ec2 describe-availability-zones \
  --region <AWS_REGION> \
  --query "AvailabilityZones[?ZoneId=='<SUPPORTED_AZ_ID>'].ZoneName" \
  --output text

```

## Step 1: Create an endpoint service

Private Links connect to an AWS endpoint service backed by a Network Load Balancer (NLB).

**Web**:

1. Sign in to the [AWS Console](https://aws.amazon.com/console/).
2. Select **VPC** → **PrivateLink and Lattice** → **Endpoint services**.
3. Select **Create endpoint service**.
4. For **Endpoint service settings**, select **Network**.
5. For **Available load balancers**, select your NLB.
6. In the **Additional settings** section, select **Acceptance required** so connections wait for your approval.
7. Select **Create**.

   Note the generated service name for the next step. It has the following form:

   ```text
   com.amazonaws.vpce.<AWS_REGION>.vpce-svc-0a1b2c3d4e5f67890

   ```
8. On the endpoint service details page, select **Allow principals** → **Allow principals**.
9. In the **Principals to add** section, copy and paste the ARN of the LiveKit production principal:

   ```text
   arn:aws:iam::266092630715:root

   ```

   This authorizes LiveKit to connect to your endpoint service. Don't use a wildcard principal. Adding the LiveKit principal explicitly ensures only authorized LiveKit connections can reach your service.
10. Select **Allow principals**.

---

**CLI**:

1. Create the endpoint service for your NLB, requiring acceptance so connections wait for your approval:

   ```shell
   aws ec2 create-vpc-endpoint-service-configuration \
     --region <AWS_REGION> \
     --network-load-balancer-arns <NLB_ARN> \
     --acceptance-required

   ```

   The following example response includes the service ID and the generated service name. Note the `ServiceId` and `ServiceName` for the next steps:

   ```text
   "ServiceId": "vpce-svc-0a1b2c3d4e5f67890",
   "ServiceName": "com.amazonaws.vpce.us-east-1.vpce-svc-0a1b2c3d4e5f67890"

   ```
2. Allow LiveKit to connect by adding the LiveKit production principal:

   ```shell
   aws ec2 modify-vpc-endpoint-service-permissions \
     --region <AWS_REGION> \
     --service-id <SERVICE_ID> \
     --add-allowed-principals arn:aws:iam::266092630715:root

   ```

   This authorizes LiveKit to connect to your endpoint service. Don't use a wildcard principal. Adding the LiveKit principal explicitly ensures only authorized LiveKit connections can reach your service.

## Step 2: Create a private link in LiveKit

Create a link with the LiveKit CLI or the LiveKit Cloud dashboard. For all CLI options, see the `private-link create` [reference](https://docs.livekit.io/reference/developer-tools/livekit-cli/agent/deployment/private-links.md#create).

**Web**:

1. Navigate to your project **Settings** page (https://cloud.livekit.io/projects/p_/settings/private-links) → **Private links**.
2. Select **Create new private link**.
3. Enter a name for the link and complete all other fields:
   - The **LiveKit region** must match the region your agent is deployed to.
   - For **Cloud provider**, select **AWS**.
   - The **Port** field must match the port configured for your NLB listener.
   - For **Endpoint**, enter the name of the AWS endpoint service you created in the [previous step](#create-endpoint).
4. Select **Create**.

---

**CLI**:

```shell
lk --project <LIVEKIT_PROJECT> agent private-link create \
  --name <LINK_NAME> \
  --region <LIVEKIT_AGENT_REGION> \
  --port <TCP_PORT> \
  --endpoint '<AWS_ENDPOINT_SERVICE_NAME>'

```

Replace the following:

- <LIVEKIT_PROJECT> Name of the project you want to create the link in.
- <LINK_NAME> Name of the link you want to create.
- <LIVEKIT_AGENT_REGION> Region your LiveKit agent is deployed to.
- <TCP_PORT> Port your agent needs to reach. It must match the port configured for your NLB listener.
- <AWS_ENDPOINT_SERVICE_NAME> Name of the endpoint service you created in the previous step.

LiveKit derives the AWS region from the endpoint service name, so you don't need to pass it separately. Your endpoint service doesn't need to be in the same region as your agent, but using the same region reduces latency. For a list of supported regions, see [Supported providers and regions](https://docs.livekit.io/deploy/agents/private-links.md#providers-regions).

For example, the following command creates a private link named `customer-redis` to an endpoint service in the `us-east-1` AWS region:

```shell
lk --project production agent private-link create \
  --name customer-redis \
  --region us-east \
  --port 6379 \
  --endpoint 'com.amazonaws.vpce.us-east-1.vpce-svc-0a1b2c3d4e5f67890'

```

Save the private link ID and the generated `*.link` hostname for later use.

## Step 3: Approve the connection in AWS

After you create the link, LiveKit requests a connection to your endpoint service. You must approve the request in AWS. The request comes from the LiveKit AWS account, `266092630715`.

> ℹ️ **Links must be in pending approval state to approve**
> 
> Wait for the private link status to reach `PENDING_APPROVAL` before you approve the request in AWS. To view the status, see [Confirm the link is healthy](#confirm-healthy).

**Web**:

1. In the AWS Console, select **VPC** → **PrivateLink and Lattice** → **Endpoint services**.
2. Select your endpoint service and select the **Endpoint connections** tab.
3. Find the pending connection and verify the **Owner** is `266092630715`.
4. Select the connection, then select **Actions** → **Accept endpoint connection request**.
5. When prompted, enter **accept** and select **Accept**.

---

**CLI**:

1. List pending connection requests, and verify the **Owner** is `266092630715`:

   ```shell
   aws ec2 describe-vpc-endpoint-connections \
     --region <AWS_REGION> \
     --filters Name=service-id,Values=<SERVICE_ID> \
               Name=vpc-endpoint-state,Values=pendingAcceptance \
     --query "VpcEndpointConnections[].{Endpoint:VpcEndpointId,Owner:VpcEndpointOwner}" \
     --output table

   ```
2. Accept the connection request using the VPC endpoint ID in the **Endpoint** column from the previous command:

   ```shell
   aws ec2 accept-vpc-endpoint-connections \
     --region <AWS_REGION> \
     --service-id <SERVICE_ID> \
     --vpc-endpoint-ids <VPC_ENDPOINT_ID>

   ```

For the full CLI reference, see [`aws ec2 describe-vpc-endpoint-connections`](https://docs.aws.amazon.com/cli/latest/reference/ec2/describe-vpc-endpoint-connections.html) and [`aws ec2 accept-vpc-endpoint-connections`](https://docs.aws.amazon.com/cli/latest/reference/ec2/accept-vpc-endpoint-connections.html).

The connection can take a few minutes to appear while LiveKit provisions resources.

## Step 4: Confirm the link is healthy

Check the link status before you connect from your agent. The link moves through `PROVISIONING` and `PENDING_APPROVAL` states before reaching `HEALTHY`. Wait for a `HEALTHY` status before you connect. For the full list of statuses, see [Status values](https://docs.livekit.io/deploy/agents/private-links/monitoring.md#status-values).

Check the link status using the CLI or the LiveKit Cloud dashboard:

**Web**:

View the link status on the [**Private links**](https://cloud.livekit.io/projects/p_/settings/private-links) page in the **Status** column.

---

**CLI**:

```shell
lk --project <LIVEKIT_PROJECT> agent private-link health-status \
  --id <PRIVATE_LINK_ID>

```

## Step 5: Test from your agent

The `*.link` hostname resolves only from a deployed agent, so run any connectivity test from within your agent runtime, not locally.

The following Python code opens 20 connections in a row and fails if any of them don't succeed:

```python
import socket

host = "<GENERATED_HOSTNAME>.link"
port = <TCP_PORT>
attempts = 20
successes = 0

for attempt in range(1, attempts + 1):
    try:
        # The .link hostname resolves only inside the agent runtime.
        with socket.create_connection((host, port), timeout=10):
            successes += 1
            print(f"success: {attempt}/{attempts}")
    except Exception as error:
        print(f"failure: {attempt}/{attempts}: {error}")

if successes != attempts:
    raise RuntimeError(f"Private Links test failed: {successes}/{attempts} succeeded")

```

After you confirm TCP connectivity, send a real request to your service (for example, a Redis `PING` or a database query) to verify authentication, TLS, and end-to-end behavior.

## Troubleshooting

Use the following sections to diagnose problems when you set up a private link on AWS.

### Common issues

The following table includes common issues that can occur when setting up a private link on AWS.

| Issue | Resolution |
| --- | --- |
| Service not found | Verify the endpoint service name and that you allowed the LiveKit principal. |
| Region unavailable | Contact LiveKit to enable support for that AWS region. |
| No endpoint connection appears, or the link stays in `PROVISIONING` | Confirm the allowed principal and wait a few minutes. If the link still shows `PROVISIONING`, confirm your NLB has a subnet in the supported Availability Zone. For steps, see [Link stays in provisioning](#stuck-provisioning). |
| Stuck in pending approval | Accept the endpoint connection request in AWS. |
| Approved but unhealthy | Check NLB target health, listener and target ports, security groups, ACLs, and Availability Zones. |
| Connection timeout | Verify the service listens on the configured port and accepts NLB traffic. |
| DNS failure in the agent | Confirm the agent uses the same LiveKit region as the link and the generated `*.link` hostname. |
| TLS certificate failure | Configure the client TLS server name, or handle TLS termination at the correct layer. |
| Test fails from your local machine | The `*.link` hostname resolves only inside a deployed agent. Run connectivity tests from your agent runtime, not locally. |

### Link stays in provisioning

A link that stays in the `PROVISIONING` status with no connection request on the **Endpoint connections** tab of your endpoint service usually means your endpoint service has no Availability Zone in common with LiveKit. LiveKit reaches your endpoint service through one Availability Zone for each AWS region, listed in [Supported providers and regions](https://docs.livekit.io/deploy/agents/private-links.md#providers-regions), so your NLB must include a subnet in that zone.

To fix the problem, do the following:

1. [Find the name of the supported Availability Zone](#find-supported-az) in your account. For example, `use1-az1` for `us-east-1`.
2. Enable the zone on your NLB:
   1. In the AWS Console, select **EC2** → **Load Balancers** and select your NLB.
   2. On the **Network mapping** tab, select **Edit subnets**.
   3. Select the supported Availability Zone and a subnet in it. If your VPC doesn't have a subnet in that zone, create one first.
   4. Select **Save changes**.
3. If your targets are in other Availability Zones, turn on cross-zone load balancing so the NLB can reach them from the supported zone:
   1. In the AWS Console, select **EC2** → **Load Balancing** → **Target Groups** and select each target group your NLB forwards to.
   2. On the **Attributes** tab, select **Edit**.
   3. For **Cross-zone load balancing**, select **On**, then select **Save changes**.

   If your NLB forwards to an Application Load Balancer, the target group type is `alb` and the target group has no cross-zone setting of its own. Turn on cross-zone load balancing on the **Attributes** tab of your NLB instead. To learn more, see [Cross-zone load balancing](https://docs.aws.amazon.com/elasticloadbalancing/latest/network/edit-load-balancer-attributes.html#load-balancer-cross-zone) in the AWS documentation.

   AWS charges for data transfer between Availability Zones when cross-zone load balancing is on. To learn more, see [Cross-zone load balancing for target groups](https://docs.aws.amazon.com/elasticloadbalancing/latest/network/edit-target-group-attributes.html#target-group-cross-zone) in the AWS documentation.
4. Wait a few minutes for the NLB changes to propagate, then refresh your endpoint service configuration:

   ```shell
   aws ec2 modify-vpc-endpoint-service-configuration \
     --region <AWS_REGION> \
     --service-id <SERVICE_ID>

   ```

   Run the command once for each endpoint service, not once for each private link. For example, if two private links share one endpoint service, run it once.
5. Confirm the zones your endpoint service covers:

   ```shell
   aws ec2 describe-vpc-endpoint-service-configurations \
     --region <AWS_REGION> \
     --service-ids <SERVICE_ID> \
     --query "ServiceConfigurations[].{Service:ServiceId,NLBs:NetworkLoadBalancerArns,Zones:AvailabilityZones,ZoneIds:AvailabilityZoneIds}" \
     --output json

   ```

   Check that the supported Availability Zone ID for your region appears in the `ZoneIds` list.

LiveKit retries provisioning automatically, so you don't need to create a new private link. After the retry succeeds, the link moves to `PENDING_APPROVAL` and the connection request appears on your endpoint service. To approve it, see [Approve the connection in AWS](#approve).

## Additional resources

The following topics provide additional information about Private Links.

- **[Private Links](https://docs.livekit.io/deploy/agents/private-links.md)**: How Private Links work, supported regions, and limitations.

- **[AWS PrivateLink docs](https://docs.aws.amazon.com/vpc/latest/privatelink/what-is-privatelink.html)**: Learn how to create and configure AWS PrivateLink-based VPC endpoints.

- **[Monitor and manage Private Links](https://docs.livekit.io/deploy/agents/private-links/monitoring.md)**: Check link status and manage links programmatically.

- **[Private Links CLI reference](https://docs.livekit.io/reference/developer-tools/livekit-cli/agent/deployment/private-links.md)**: Reference for the private link commands in the LiveKit CLI.

- **[Set up on Azure](https://docs.livekit.io/deploy/agents/private-links/azure.md)**: Connect through Azure Private Link using a Private Link Service.

---

This document was rendered at 2026-11-14T15:19:25.668Z.
For the latest version of this document, see [https://docs.livekit.io/deploy/agents/private-links/aws.md](https://docs.livekit.io/deploy/agents/private-links/aws.md).

To explore all LiveKit documentation, see [llms.txt](https://docs.livekit.io/llms.txt).