> ## Documentation Index
> Fetch the complete documentation index at: https://private-7c7dfe99-vortex-format.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# BYOC AWS private networking setup

> Set up VPC Peering or PrivateLink for BYOC on AWS

export const Image = ({img, alt, size = "lg"}) => {
  const normalizedSize = ["sm", "md", "lg"].includes(size) ? size : "lg";
  return <div className={`ch-image-${normalizedSize}`}>
      <Frame>
        <img src={img} alt={alt} />
      </Frame>
    </div>;
};

ClickHouse BYOC on AWS supports two private connection options including VPC Peering and AWS PrivateLink.

<h2 id="common-prerequisites">
  Prerequisites
</h2>

Common steps required by both VPC peering and PrivateLink.

<h3 id="step-enable-private-load-balancer-for-clickhouse-byoc">
  Enable private load balancer for ClickHouse BYOC
</h3>

In the ClickHouse Cloud console, enable the **Private load balancer** for your BYOC infrastructure.

<Image img="https://mintcdn.com/private-7c7dfe99-vortex-format/N5J92FpLvYKK3vEv/images/cloud/reference/byoc-private-load-balancer.webp?fit=max&auto=format&n=N5J92FpLvYKK3vEv&q=85&s=1068a3ea0c5826a85c5b1d43f581058c" size="md" alt="BYOC Enable Private Load Balancer" border width="2438" height="1724" data-path="images/cloud/reference/byoc-private-load-balancer.webp" />

<h2 id="aws-vpc-peering">
  Set up VPC peering
</h2>

To create or delete VPC peering for ClickHouse BYOC, follow the steps:

<Steps>
  <Step title="Create a peering connection" id="step-1-create-a-peering-connection">
    1. Navigate to the VPC Dashboard in ClickHouse BYOC account.
    2. Select Peering Connections.
    3. Click Create Peering Connection
    4. Set the VPC Requester to the ClickHouse VPC ID.
    5. Set the VPC Accepter to the target VPC ID. (Select another account if applicable)
    6. Click Create Peering Connection.

    <Image img="https://mintcdn.com/private-7c7dfe99-vortex-format/0Bwb4z8TuZiplPdq/images/cloud/reference/byoc-vpcpeering-1.webp?fit=max&auto=format&n=0Bwb4z8TuZiplPdq&q=85&s=d7e1379bdc9caa4be4471648680fb2df" size="lg" alt="BYOC Create Peering Connection" border width="1600" height="1042" data-path="images/cloud/reference/byoc-vpcpeering-1.webp" />
  </Step>

  <Step title="Accept the peering connection request" id="step-2-accept-the-peering-connection-request">
    Go to the peering account, in the (VPC -> Peering connections -> Actions -> Accept request) page customer can approve this VPC peering request.

    <Image img="https://mintcdn.com/private-7c7dfe99-vortex-format/0Bwb4z8TuZiplPdq/images/cloud/reference/byoc-vpcpeering-2.webp?fit=max&auto=format&n=0Bwb4z8TuZiplPdq&q=85&s=0ea1c9c94accd04c9b4452e670404a30" size="lg" alt="BYOC Accept Peering Connection" border width="1600" height="81" data-path="images/cloud/reference/byoc-vpcpeering-2.webp" />
  </Step>

  <Step title="Add destination to ClickHouse VPC route tables" id="step-3-add-destination-to-clickhouse-vpc-route-tables">
    In ClickHouse BYOC account,

    1. Select Route Tables in the VPC Dashboard.
    2. Search for the ClickHouse VPC ID. Edit each route table attached to the private subnets.
    3. Click the Edit button under the Routes tab.
    4. Click Add another route.
    5. Enter the CIDR range of the target VPC for the Destination.
    6. Select “Peering Connection” and the ID of the peering connection for the Target.

    <Image img="https://mintcdn.com/private-7c7dfe99-vortex-format/0Bwb4z8TuZiplPdq/images/cloud/reference/byoc-vpcpeering-3.webp?fit=max&auto=format&n=0Bwb4z8TuZiplPdq&q=85&s=3facd80ba283956b8ed59139bb6dd924" size="lg" alt="BYOC Add route table" border width="1600" height="112" data-path="images/cloud/reference/byoc-vpcpeering-3.webp" />
  </Step>

  <Step title="Add destination to the target VPC route tables" id="step-4-add-destination-to-the-target-vpc-route-tables">
    In the peering AWS account,

    1. Select Route Tables in the VPC Dashboard.
    2. Search for the target VPC ID.
    3. Click the Edit button under the Routes tab.
    4. Click Add another route.
    5. Enter the CIDR range of the ClickHouse VPC for the Destination.
    6. Select “Peering Connection” and the ID of the peering connection for the Target.

    <Image img="https://mintcdn.com/private-7c7dfe99-vortex-format/0Bwb4z8TuZiplPdq/images/cloud/reference/byoc-vpcpeering-4.webp?fit=max&auto=format&n=0Bwb4z8TuZiplPdq&q=85&s=5c58abae43a29fa8d92e2528dc989002" size="lg" alt="BYOC Add route table" border width="1600" height="105" data-path="images/cloud/reference/byoc-vpcpeering-4.webp" />
  </Step>

  <Step title="Edit security group to allow peered VPC access" id="step-5-edit-security-group-to-allow-peered-vpc-access">
    In the ClickHouse BYOC account, you need to update the Security Group settings to allow traffic from your peered VPC. Please contact ClickHouse Support to request the addition of inbound rules that include the CIDR ranges of your peered VPC.

    ***

    The ClickHouse service should now be accessible from the peered VPC.
  </Step>
</Steps>

To access ClickHouse privately, a private load balancer and endpoint are provisioned for secure connectivity from the user's peered VPC. The private endpoint follows the public endpoint format with a `-private` suffix. For example:

* **Public endpoint**: `h5ju65kv87.mhp0y4dmph.us-west-2.aws.clickhouse-byoc.com`
* **Private endpoint**: `h5ju65kv87-private.mhp0y4dmph.us-west-2.aws.clickhouse-byoc.com`

Optional, after verifying that peering is working, you can request the removal of the public load balancer for ClickHouse BYOC.

<h2 id="setup-privatelink">
  Set up PrivateLink
</h2>

AWS PrivateLink provides a secure and private connection to your ClickHouse BYOC services without the need for VPC peering or internet gateways. All traffic flows within the AWS network, ensuring that it never traverses the public internet.

<Note>
  **Cross-region connections.** The **Enable private link** toggle in the ClickHouse console provisions the endpoint service and covers **same-region** consumers only. AWS disables cross-region access on endpoint services by default, and the ClickHouse console doesn't manage it — if your clients are in a different region, you enable it yourself: the endpoint service lives in your BYOC account, so add the consumer regions to its **Supported regions** list in your own AWS console (see step 3 below). ClickHouse won't change or reset these values. AWS cross-region data transfer rates apply.
</Note>

<Steps>
  <Step title="Enable private link in ClickHouse console" id="step-1-enable-private-link">
    <Note>
      Make sure the **private load balancer** is turned on as a prerequisite.
    </Note>

    <Image img="https://mintcdn.com/private-7c7dfe99-vortex-format/0Bwb4z8TuZiplPdq/images/cloud/reference/byoc-privatelink.webp?fit=max&auto=format&n=0Bwb4z8TuZiplPdq&q=85&s=a114025758f21cbb43a9147128d9b93a" size="md" alt="BYOC PrivateLink Enable" border width="2800" height="1848" data-path="images/cloud/reference/byoc-privatelink.webp" />
  </Step>

  <Step title={<>Obtain endpoint <code>Service name</code></>} id="step-2-obtain-endpoint-service-name">
    1. In the ClickHouse Cloud console, navigate to the service's Settings page that you would like to connect to via PrivateLink.
    2. Click "Set up private endpoint".
    3. In the opened flyout, copy the `Service name` value — you'll use it in the next step. (It may take a while for the value to be generated after enabling PrivateLink.)
           <Image img="https://mintcdn.com/private-7c7dfe99-vortex-format/0Bwb4z8TuZiplPdq/images/cloud/security/aws-privatelink-pe-create.webp?fit=max&auto=format&n=0Bwb4z8TuZiplPdq&q=85&s=676eabb93d058a4506fc87db0e45bb3f" size="md" alt="Private Endpoints" border width="1556" height="740" data-path="images/cloud/security/aws-privatelink-pe-create.webp" />
  </Step>

  <Step title="Create endpoint in your network" id="step-3-create-endpoint">
    1. Open your **own AWS console** (i.e. the AWS account where your client application is) → VPC → Endpoints → Create endpoints.

    2. Select "Endpoint services that use NLBs and GWLBs" and use `Service name` obtained from the last step.

    3. Click "Verify service".
           <Image img="https://mintcdn.com/private-7c7dfe99-vortex-format/0Bwb4z8TuZiplPdq/images/cloud/security/aws-privatelink-endpoint-settings.webp?fit=max&auto=format&n=0Bwb4z8TuZiplPdq&q=85&s=96322f0f40ac285588788c01d33ce534" size="md" alt="AWS PrivateLink Endpoint Settings" border width="1304" height="721" data-path="images/cloud/security/aws-privatelink-endpoint-settings.webp" />

    4. (Optional) If you want to establish a cross-regional connection via PrivateLink, enable the "Cross region endpoint" checkbox and specify the service region. The service region is where your BYOC infrastructure is created. Meanwhile,
       1. Open your **BYOC AWS console** (i.e. the AWS account where your BYOC infrastructure is created) → VPC → Endpoint services → `clickhouse-cloud-infra-xxx` → Supported regions.
       2. Add the region where your client application is running to the supported regions list. By default, only the region of this BYOC infrastructure is supported. You can add multiple regions if you want to connect from different regions, and ClickHouse won't change or reset these values.
              <Image img="https://mintcdn.com/private-7c7dfe99-vortex-format/N5J92FpLvYKK3vEv/images/cloud/reference/byoc-privatelink-aws-cross-region.webp?fit=max&auto=format&n=N5J92FpLvYKK3vEv&q=85&s=56227d90fca4e96b537cf91ad96147bb" size="md" alt="AWS PrivateLink Cross Region Endpoint Settings" border width="3094" height="1820" data-path="images/cloud/reference/byoc-privatelink-aws-cross-region.webp" />

    5. Select your VPC and subnets (one per availability zone is recommended).
           <Image img="https://mintcdn.com/private-7c7dfe99-vortex-format/0Bwb4z8TuZiplPdq/images/cloud/security/aws-privatelink-select-vpc-and-subnets.webp?fit=max&auto=format&n=0Bwb4z8TuZiplPdq&q=85&s=915fc6c1c1870c366f46ad8f9867202a" size="md" alt="Select VPC and subnets" border width="1312" height="595" data-path="images/cloud/security/aws-privatelink-select-vpc-and-subnets.webp" />

    6. **Important**: Enable "Private DNS names" for the endpoint — this is required for Private DNS to function correctly.
       Private DNS for BYOC endpoints (using the `*.vpce.{subdomain}` format) leverages AWS PrivateLink's built-in "Private DNS names" feature. No Route53 records are required — DNS resolution happens automatically when:
       * "Private DNS names" is enabled and
       * "DNS Hostnames" is enabled

         via VPC Settings → DNS resolution and DNS hostnames.

         This ensures that connections using the `vpce` subdomain automatically route through the PrivateLink endpoint without additional DNS configuration.

    7. (Optional) Assign Security groups/Tags.
           <Note>
             Make sure that ports `443`, `8443`, and `9440` are allowed in the security group.
           </Note>

    8. Click "Create endpoint", wait a moment for the endpoint to be created.

    9. After creating the endpoint, copy the `Endpoint ID` value — you'll use it in the next step.
           <Image img="https://mintcdn.com/private-7c7dfe99-vortex-format/0Bwb4z8TuZiplPdq/images/cloud/security/aws-privatelink-vpc-endpoint-id.webp?fit=max&auto=format&n=0Bwb4z8TuZiplPdq&q=85&s=bcd8ee19ebac2c9c6b1c53654151e3d3" size="md" alt="VPC Endpoint ID" border width="467" height="212" data-path="images/cloud/security/aws-privatelink-vpc-endpoint-id.webp" />
  </Step>

  <Step title="Approve the endpoint connection" id="step-4-approve-endpoint-connection">
    1. Open your **BYOC VPC console** again → Endpoint services → `clickhouse-cloud-infra-xxx` → Endpoint connections.
    2. Find the connection request created from your own VPC and click "Accept endpoint connection request" to approve it.
           <Image img="https://mintcdn.com/private-7c7dfe99-vortex-format/N5J92FpLvYKK3vEv/images/cloud/reference/byoc-privatelink-2.webp?fit=max&auto=format&n=N5J92FpLvYKK3vEv&q=85&s=6134dafc45716b386db7d0b0b04817fc" size="md" alt="BYOC PrivateLink Approve" border width="1600" height="975" data-path="images/cloud/reference/byoc-privatelink-2.webp" />
  </Step>

  <Step title={<>Add <code>Endpoint ID</code> to ClickHouse service allow list</>} id="step-5-add-endpoint-id-to-services-allow-list">
    1. In the ClickHouse Cloud console, navigate to the service's Settings page that you would like to connect to via PrivateLink.
    2. Click "Set up private endpoint".
    3. In the opened flyout, enter the `Endpoint ID` obtained from the last step with an optional description.
    4. Click "Create endpoint".

    <Note>
      If you want to allow access from an existing PrivateLink connection, use the existing endpoint dropdown menu.
      The dropdown will show the existing PrivateLink connections to the services within the same infrastructure.
    </Note>

    <Image img="https://mintcdn.com/private-7c7dfe99-vortex-format/0Bwb4z8TuZiplPdq/images/cloud/security/aws-privatelink-pe-filters.webp?fit=max&auto=format&n=0Bwb4z8TuZiplPdq&q=85&s=e2428aa69866218b5f9891603e085414" size="md" alt="Private Endpoints Filter" border width="1555" height="748" data-path="images/cloud/security/aws-privatelink-pe-filters.webp" />
  </Step>

  <Step title="Access an instance using PrivateLink" id="step-6-connect-via-privatelink">
    1. In the ClickHouse Cloud console, navigate to service's Settings page.
    2. Click "Set up private endpoint".
    3. In the opened flyout, copy the `DNS name`.

           <Image img="https://mintcdn.com/private-7c7dfe99-vortex-format/0Bwb4z8TuZiplPdq/images/cloud/security/aws-privatelink-pe-dns-name.webp?fit=max&auto=format&n=0Bwb4z8TuZiplPdq&q=85&s=ad9174a5f20124009965fcefd358df1c" size="md" alt="Private Endpoint DNS Name" border width="1551" height="740" data-path="images/cloud/security/aws-privatelink-pe-dns-name.webp" />

       Access to ClickHouse services via PrivateLink is controlled at two levels:

       1. **Istio Authorization Policy**: ClickHouse Cloud's service-level authorization policies
       2. **VPC Endpoint Security Group**: The security group attached to your VPC endpoint controls which resources in your VPC can use the endpoint

           <Note>
             The private load balancer's "Enforce inbound rules on PrivateLink traffic" feature is disabled, so access is controlled by Istio authorization policies and your VPC endpoint's security group only.
           </Note>
  </Step>
</Steps>
