--- title: Connect to TiDB Cloud Starter or Essential via AWS PrivateLink summary: Learn how to connect to your TiDB Cloud cluster via private endpoint. --- # Connect to TiDB Cloud Starter or Essential via AWS PrivateLink This document describes how to connect to your TiDB Cloud Starter or TiDB Cloud Essential cluster via AWS PrivateLink. > **Tip:** > > - To learn how to connect to a TiDB Cloud Dedicated cluster via private endpoint with AWS, see [Connect to a TiDB Cloud Dedicated Cluster via AWS PrivateLink](/tidb-cloud/set-up-private-endpoint-connections.md). > - To learn how to connect to a TiDB Cloud Dedicated cluster via private endpoint with Azure, see [Connect to a TiDB Cloud Dedicated Cluster via Azure Private Link](/tidb-cloud/set-up-private-endpoint-connections-on-azure.md). > - To learn how to connect to a TiDB Cloud Dedicated cluster via private endpoint with Google Cloud, see [Connect to a TiDB Cloud Dedicated Cluster via Google Cloud Private Service Connect](/tidb-cloud/set-up-private-endpoint-connections-on-google-cloud.md). TiDB Cloud supports highly secure and one-way access to the TiDB Cloud service hosted in an AWS VPC via the [AWS PrivateLink](https://aws.amazon.com/privatelink/?privatelink-blogs.sort-by=item.additionalFields.createdDate&privatelink-blogs.sort-order=desc), as if the service were in your own VPC. A private endpoint is exposed in your VPC and you can create a connection to the TiDB Cloud service via the endpoint with permission. Powered by AWS PrivateLink, the endpoint connection is secure and private, and does not expose your data to the public internet. In addition, the endpoint connection supports CIDR overlap and is easier for network management. The architecture of the private endpoint is as follows: ![Private endpoint architecture](https://docs-download.pingcap.com/media/images/docs/tidb-cloud/aws-private-endpoint-arch.png) For more detailed definitions of the private endpoint and endpoint service, see the following AWS documents: - [What is AWS PrivateLink?](https://docs.aws.amazon.com/vpc/latest/privatelink/what-is-privatelink.html) - [AWS PrivateLink concepts](https://docs.aws.amazon.com/vpc/latest/privatelink/concepts.html) ## Restrictions - Currently, TiDB Cloud supports AWS PrivateLink connections only when the endpoint service is hosted in AWS. If the service is hosted in other cloud providers, the AWS PrivateLink connection is not applicable. - Cross-region private endpoint connections is not supported. ## Prerequisites Make sure that DNS hostnames and DNS resolution are both enabled in your AWS VPC settings. They are disabled by default when you create a VPC in the [AWS Management Console](https://console.aws.amazon.com/). ## Set up a private endpoint with AWS To connect to your TiDB Cloud Starter or TiDB Cloud Essential cluster via a private endpoint, follow these steps: 1. [Choose a TiDB cluster](#step-1-choose-a-tidb-cluster) 2. [Create an AWS interface endpoint](#step-2-create-an-aws-interface-endpoint) 3. [Connect to your TiDB cluster](#step-3-connect-to-your-tidb-cluster) ### Step 1. Choose a TiDB cluster 1. On the [**Clusters**](https://tidbcloud.com/project/clusters) page, click the name of your target TiDB Cloud Starter or TiDB Cloud Essential cluster to go to its overview page. 2. Click **Connect** in the upper-right corner. A connection dialog is displayed. 3. In the **Connection Type** drop-down list, select **Private Endpoint**. 4. Take a note of **Service Name**, **Availability Zone ID**, and **Region ID**. > **Note:** > > You only need to create one private endpoint per AWS region, which can be shared by all TiDB Cloud Starter or TiDB Cloud Essential clusters located in the same region. ### Step 2. Create an AWS interface endpoint
To use the AWS Management Console to create a VPC interface endpoint, perform the following steps: 1. Sign in to the [AWS Management Console](https://aws.amazon.com/console/) and open the Amazon VPC console at [https://console.aws.amazon.com/vpc/](https://console.aws.amazon.com/vpc/). 2. Click **Endpoints** in the navigation pane, and then click **Create Endpoint** in the upper-right corner. The **Create endpoint** page is displayed. ![Verify endpoint service](https://docs-download.pingcap.com/media/images/docs/tidb-cloud/private-endpoint/create-endpoint-2.png) 3. Select **Endpoint services that use NLBs and GWLBs**. 4. Enter the service name that you found in [step 1](#step-1-choose-a-tidb-cluster). 5. Click **Verify service**. 6. Select your VPC in the drop-down list. Expand **Additional settings** and select the **Enable DNS name** checkbox. 7. In the **Subnets** area, select the availability zone where your TiDB cluster is located, and select the Subnet ID. 8. Select your security group properly in the **Security groups** area. > **Note:** > > Make sure the selected security group allows inbound access from your EC2 instances on port 4000. 9. Click **Create endpoint**.
To use the AWS CLI to create a VPC interface endpoint, perform the following steps: 1. To get the **VPC ID** and **Subnet ID**, navigate to your AWS Management Console, and locate them in the relevant sections. Make sure that you fill in the **Availability Zone ID** that you found in [step 1](#step-1-choose-a-tidb-cluster). 2. Copy the command provided below, replace the relevant arguments with the information you obtained, and then execute it in your terminal. ```bash aws ec2 create-vpc-endpoint --vpc-id ${your_vpc_id} --region ${region_id} --service-name ${service_name} --vpc-endpoint-type Interface --subnet-ids ${your_subnet_id} ``` > **Tip:** > > Before running the command, you need to have AWS CLI installed and configured. See [AWS CLI configuration basics](https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-quickstart.html) for details.
Then you can connect to the endpoint service with the private DNS name. ### Step 3: Connect to your TiDB cluster After you have created the interface endpoint, go back to the TiDB Cloud console and take the following steps: 1. On the [**Clusters**](https://tidbcloud.com/project/clusters) page, click the name of your target cluster to go to its overview page. 2. Click **Connect** in the upper-right corner. A connection dialog is displayed. 3. In the **Connection Type** drop-down list, select **Private Endpoint**. 4. In the **Connect With** drop-down list, select your preferred connection method. The corresponding connection string is displayed at the bottom of the dialog. 5. Connect to your cluster with the connection string. > **Tip:** > > If you cannot connect to the cluster, the reason might be that the security group of your VPC endpoint in AWS is not properly set. See [this FAQ](#troubleshooting) for solutions. > > When creating a VPC endpoint, if you encounter an error `private-dns-enabled cannot be set because there is already a conflicting DNS domain for gatewayXX-privatelink.XX.prod.aws.tidbcloud.com in the VPC vpc-XXXXX`, it is due to that a private endpoint has already been created, and creating a new one is unnecessary. ## Troubleshooting ### I cannot connect to a TiDB cluster via a private endpoint after enabling private DNS. Why? You might need to properly set the security group for your VPC endpoint in the AWS Management Console. Go to **VPC** > **Endpoints**. Right-click your VPC endpoint and select the proper **Manage security groups**. A proper security group within your VPC that allows inbound access from your EC2 instances on Port 4000 or a customer-defined port. ![Manage security groups](https://docs-download.pingcap.com/media/images/docs/tidb-cloud/private-endpoint/manage-security-groups.png)