Skip to content

Commit 0b29ebf

Browse files
committed
Merge multiregional AWS private link changed
1 parent 37104e2 commit 0b29ebf

File tree

8 files changed

+205
-339
lines changed

8 files changed

+205
-339
lines changed

docs/cloud/security/aws-privatelink.md

Lines changed: 102 additions & 105 deletions
Large diffs are not rendered by default.

docs/cloud/security/azure-privatelink.md

Lines changed: 43 additions & 104 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ description: 'How to set up Azure Private Link'
66
keywords: ['azure', 'private link', 'privatelink']
77
---
88

9+
import ScalePlanFeatureBadge from '@theme/badges/ScalePlanFeatureBadge';
910
import azure_pe from '@site/static/images/cloud/security/azure-pe.png';
1011
import azure_privatelink_pe_create from '@site/static/images/cloud/security/azure-privatelink-pe-create.png';
1112
import azure_private_link_center from '@site/static/images/cloud/security/azure-private-link-center.png';
@@ -25,9 +26,7 @@ import azure_privatelink_pe_dns from '@site/static/images/cloud/security/azure-p
2526

2627
# Azure Private Link
2728

28-
:::note
29-
Azure Private Link can be enabled only on ClickHouse Cloud **Production** services. **Development** services are not supported.
30-
:::
29+
<ScalePlanFeatureBadge feature="Azure Private Link"/>
3130

3231
This guide shows how to use Azure Private Link to provide private connectivity via a virtual network between Azure (including customer-owned and Microsoft Partner services) and ClickHouse Cloud. Azure Private Link simplifies the network architecture and secures the connection between endpoints in Azure by eliminating data exposure to the public internet.
3332

@@ -39,7 +38,7 @@ Unlike AWS and GCP, Azure supports cross-region connectivity via Private Link. T
3938
Additional charges may be applied to inter-region traffic. Please check latest Azure documentation.
4039
:::
4140

42-
Please complete the following steps to enable Azure Private Link:
41+
**Please complete the following steps to enable Azure Private Link:**
4342

4443
1. Obtain Azure connection alias for Private Link
4544
1. Create a Private Endpoint in Azure
@@ -48,58 +47,64 @@ Please complete the following steps to enable Azure Private Link:
4847
1. Access your ClickHouse Cloud service using Private Link
4948

5049

51-
Find complete Terraform example for Azure Private Link [here](https://github.com/ClickHouse/terraform-provider-clickhouse/tree/main/examples/PrivateLinkAzure).
50+
## Attention {#attention}
51+
ClickHouse attempts to group your services to reuse the same published [Private Link service](https://learn.microsoft.com/en-us/azure/private-link/private-link-service-overview) within the Azure region. However, this grouping is not guaranteed, especially if you spread your services across multiple ClickHouse organizations.
52+
If you already have Private Link configured for other services in your ClickHouse organization, you can often skip most of the steps because of that grouping and proceed directly to the final step: [Add the Private Endpoint GUID to your service(s) allow list](#add-private-endpoint-guid-to-services-allow-list).
53+
54+
Find Terraform examples [here](https://github.com/ClickHouse/terraform-provider-clickhouse/tree/main/examples/).
5255

5356
## Obtain Azure connection alias for Private Link {#obtain-azure-connection-alias-for-private-link}
5457

5558
### Option 1: ClickHouse Cloud console {#option-1-clickhouse-cloud-console}
5659

57-
In the ClickHouse Cloud console, open the service that you would like to connect via PrivateLink, then open the **Settings** menu. Click on the **Set up private endpoint** button. Copy the **Service name** which will be used for setting up Private Link.
60+
In the ClickHouse Cloud console, open the service that you would like to connect via PrivateLink, then open the **Settings** menu. Click on the **Set up private endpoint** button. Make a note of the `Service name` and `DNS name` which will be used for setting up Private Link.
5861

5962
<img src={azure_privatelink_pe_create} alt="Private Endpoints" />
6063

64+
Make a note of the `Service name` and `DNS name`, it will be needed in the next steps.
65+
6166
### Option 2: API {#option-2-api}
6267

63-
Before you get started, you'll need a ClickHouse Cloud API key. You can [create a new key](/cloud/manage/openapi) or use an existing one. Note that you will need an **Admin** key to manage the Private Link configuration.
68+
Before you get started, you'll need a ClickHouse Cloud API key. You can [create a new key](/cloud/manage/openapi) or use an existing one.
6469

6570
Once you have your API key, set the following environment variables before running any commands:
6671

6772
```bash
68-
REGION=<region code, use Azure format>
73+
REGION=<region code, use Azure format, for example: westus3>
6974
PROVIDER=azure
7075
KEY_ID=<Key ID>
7176
KEY_SECRET=<Key secret>
7277
ORG_ID=<set ClickHouse organization ID>
78+
SERVICE_NAME=<Your ClickHouse service name>
7379
```
7480

75-
Obtain an instance ID from your region:
76-
77-
You'll need at least one ClickHouse Cloud service deployed in the specified region to perform this step.
78-
79-
```bash
80-
curl --silent --user ${KEY_ID:?}:${KEY_SECRET:?} https://api.clickhouse.cloud/v1/organizations/${ORG_ID:?}/services | jq ".result[] | select (.region==\"${REGION:?}\" and .provider==\"${PROVIDER:?}\") | .id " -r | head -1 | tee instance_id
81-
```
82-
83-
Create an `INSTANCE_ID` environment variable using the ID you received in the previous step:
81+
Get your ClickHouse `INSTANCE_ID` by filtering by region, provider and service name:
8482

85-
```bash
86-
INSTANCE_ID=$(cat instance_id)
83+
```shell
84+
INSTANCE_ID=$(curl --silent --user "${KEY_ID:?}:${KEY_SECRET:?}" \
85+
"https://api.clickhouse.cloud/v1/organizations/${ORG_ID:?}/services" | \
86+
jq ".result[] | select (.region==\"${REGION:?}\" and .provider==\"${PROVIDER:?}\" and .name==\"${SERVICE_NAME:?}\") | .id " -r)
8787
```
8888

8989
Obtain your Azure connection alias and Private DNS hostname for Private Link:
9090

9191
```bash
92-
curl --silent --user ${KEY_ID:?}:${KEY_SECRET:?} https://api.clickhouse.cloud/v1/organizations/${ORG_ID:?}/services/${INSTANCE_ID:?}/privateEndpointConfig | jq .result
92+
curl --silent --user "${KEY_ID:?}:${KEY_SECRET:?}" "https://api.clickhouse.cloud/v1/organizations/${ORG_ID:?}/services/${INSTANCE_ID:?}/privateEndpointConfig" | jq .result
9393
{
94-
"endpointServiceId": "production-westus3-0-0.63c890a9-4d32-48cc-a08c-8cd92dfb1ad3.westus3.azure.privatelinkservice",
95-
...
94+
"endpointServiceId": "production-westus3-0-0.xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx.westus3.azure.privatelinkservice",
95+
"privateDnsHostname": "xxxxxxxxxx.westus3.privatelink.azure.clickhouse.cloud"
9696
}
9797
```
9898

9999
Make a note of the `endpointServiceId`. You'll use it in the next step.
100100

101101
## Create a Private Endpoint in Azure {#create-private-endpoint-in-azure}
102102

103+
:::important
104+
This section covers ClickHouse-specific details for configuring ClickHouse via Azure Private Link. Azure-specific steps are provided as a reference to guide you on where to look, but they may change over time without notice from the Azure cloud provider. Please consider Azure configuration based on your specific use case.
105+
Please note that ClickHouse is not responsible for configuring the required Azure private endpoints, DNS records. For any issues related to Azure configuration tasks, contact Azure Support directly.
106+
:::
107+
103108
In this section, we're going to create a Private Endpoint in Azure. You can use either the Azure Portal or Terraform.
104109

105110
### Option 1: Using Azure Portal to create a Private Endpoint in Azure {#option-1-using-azure-portal-to-create-a-private-endpoint-in-azure}
@@ -204,85 +209,24 @@ Under properties, find `resourceGuid` field and copy this value:
204209

205210
## Setting up DNS for Private Link {#setting-up-dns-for-private-link}
206211

207-
You need will need to create a Private DNS zone (`${location_code}.privatelink.azure.clickhouse.cloud`) and attach it to your VNet to access resources via Private Link.
208-
209-
### Create Private DNS zone {#create-private-dns-zone}
210-
211-
**Option 1: Using Azure portal**
212-
213-
Please follow the following guide to [create an Azure private DNS zone using the Azure Portal](https://learn.microsoft.com/en-us/azure/dns/private-dns-getstarted-portal).
214-
215-
**Option 2: Using Terraform**
216-
217-
Use the following Terraform template to create a Private DNS zone:
218-
219-
```json
220-
resource "azurerm_private_dns_zone" "clickhouse_cloud_private_link_zone" {
221-
name = "${var.location}.privatelink.azure.clickhouse.cloud"
222-
resource_group_name = var.resource_group_name
223-
}
224-
```
225-
226-
### Create a wildcard DNS record {#create-a-wildcard-dns-record}
227-
228-
Create a wildcard record and point to your Private Endpoint:
229-
230-
**Option 1: Using Azure Portal**
231-
232-
1. Open the `MyAzureResourceGroup` resource group and select the `${region_code}.privatelink.azure.clickhouse.cloud` private zone.
233-
2. Select + Record set.
234-
3. For Name, type `*`.
235-
4. For IP Address, type the IP address you see for Private Endpoint.
236-
5. Select **OK**.
237-
238-
<img src={azure_pl_dns_wildcard} alt="Private Link DNS Wildcard Setup" />
239-
240-
**Option 2: Using Terraform**
241-
242-
Use the following Terraform template to create a wildcard DNS record:
243-
244-
```json
245-
resource "azurerm_private_dns_a_record" "example" {
246-
name = "*"
247-
zone_name = var.zone_name
248-
resource_group_name = var.resource_group_name
249-
ttl = 300
250-
records = ["10.0.0.4"]
251-
}
252-
```
253-
254-
### Create a virtual network link {#create-a-virtual-network-link}
255-
256-
To link the private DNS zone to a virtual network, you'll need create a virtual network link.
257-
258-
**Option 1: Using Azure Portal**
259-
260-
Please follow the following guide to [link the virtual network to your private DNS zone](https://learn.microsoft.com/en-us/azure/dns/private-dns-getstarted-portal#link-the-virtual-network).
212+
:::note
213+
There are various ways to configure DNS. Please set up DNS according to your specific use case.
214+
:::
261215

262-
**Option 2: Using Terraform**
216+
You need to point "DNS name", taken from [Obtain Azure connection alias for Private Link](#obtain-azure-connection-alias-for-private-link) step, to Private Endpoint IP address. This ensures that services/components within your VPC/Network can resolve it properly.
263217

264-
Use the following Terraform template to link the virtual network to your private DNS zone:
265-
266-
```json
267-
resource "azurerm_private_dns_zone_virtual_network_link" "example" {
268-
name = "test"
269-
resource_group_name = var.resource_group_name
270-
private_dns_zone_name = var.zone_name
271-
virtual_network_id = var.virtual_network_id
272-
}
273-
```
274218

275219
### Verify DNS setup {#verify-dns-setup}
276220

277-
Any record within the `westus3.privatelink.azure.clickhouse.cloud` domain should be pointed to the Private Endpoint IP. (10.0.0.4 in this example).
221+
`xxxxxxxxxx.westus3.privatelink.azure.clickhouse.cloud` domain should be pointed to the Private Endpoint IP. (10.0.0.4 in this example).
278222

279223
```bash
280-
nslookup instance-id.westus3.privatelink.azure.clickhouse.cloud.
224+
nslookup xxxxxxxxxx.westus3.privatelink.azure.clickhouse.cloud.
281225
Server: 127.0.0.53
282226
Address: 127.0.0.53#53
283227

284228
Non-authoritative answer:
285-
Name: instance-id.westus3.privatelink.azure.clickhouse.cloud
229+
Name: xxxxxxxxxx.westus3.privatelink.azure.clickhouse.cloud
286230
Address: 10.0.0.4
287231
```
288232

@@ -309,7 +253,7 @@ ENDPOINT_ID=<Private Endpoint resourceGuid>
309253
REGION=<region code, use Azure format>
310254
```
311255

312-
Set the `VPC_ENDPOINT` environment variable using data from the [Obtaining the Private Endpoint `resourceGuid`](#obtaining-private-endpoint-resourceguid) step.
256+
Set the `ENDPOINT_ID` environment variable using data from the [Obtaining the Private Endpoint `resourceGuid`](#obtaining-private-endpoint-resourceguid) step.
313257

314258
Run the following command to add the Private Endpoint:
315259

@@ -351,7 +295,7 @@ EOF
351295
After adding or removing a Private Endpoint, run the following command to apply it to your organization:
352296

353297
```bash
354-
curl --silent --user ${KEY_ID:?}:${KEY_SECRET:?} -X PATCH -H "Content-Type: application/json" https://api.clickhouse.cloud/v1/organizations/${ORG_ID:?} -d @pl_config_org.json
298+
curl --silent --user "${KEY_ID:?}:${KEY_SECRET:?}" -X PATCH -H "Content-Type: application/json" "https://api.clickhouse.cloud/v1/organizations/${ORG_ID:?}" -d @pl_config_org.json
355299
```
356300

357301
## Add the Private Endpoint GUID to your service(s) allow list {#add-private-endpoint-guid-to-services-allow-list}
@@ -414,16 +358,13 @@ EOF
414358
After adding or removing a Private Endpoint to the services allow list, run the following command to apply it to your organization:
415359

416360
```bash
417-
curl --silent --user ${KEY_ID:?}:${KEY_SECRET:?} -X PATCH -H "Content-Type: application/json" https://api.clickhouse.cloud/v1/organizations/${ORG_ID:?}/services/${INSTANCE_ID?} -d @pl_config.json | jq
361+
curl --silent --user "${KEY_ID:?}:${KEY_SECRET:?}" -X PATCH -H "Content-Type: application/json" "https://api.clickhouse.cloud/v1/organizations/${ORG_ID:?}/services/${INSTANCE_ID:?}" -d @pl_config.json | jq
418362
```
419363

420364
## Access your ClickHouse Cloud service using Private Link {#access-your-clickhouse-cloud-service-using-private-link}
421365

422-
Each service with Private Link enabled has a public and private endpoint. In order to connect using Private Link, you need to use a private endpoint which will be `privateDnsHostname`.
366+
Each service with Private Link enabled has a public and private endpoint. In order to connect using Private Link, you need to use a private endpoint which will be `privateDnsHostname`<sup>API</sup> or `DNS name`<sup>console</sup> taken from [Obtain Azure connection alias for Private Link](#obtain-azure-connection-alias-for-private-link).
423367

424-
:::note
425-
Private DNS hostname is only available from your Azure VNet. Do not try to resolve the DNS host from a machine that resides outside of Azure VNet.
426-
:::
427368

428369
### Obtaining the Private DNS Hostname {#obtaining-the-private-dns-hostname}
429370

@@ -447,7 +388,7 @@ INSTANCE_ID=<Instance ID>
447388
Run the following command:
448389

449390
```bash
450-
curl --silent --user ${KEY_ID:?}:${KEY_SECRET:?} https://api.clickhouse.cloud/v1/organizations/${ORG_ID:?}/services/${INSTANCE_ID:?}/privateEndpointConfig | jq .result
391+
curl --silent --user "${KEY_ID:?}:${KEY_SECRET:?}" "https://api.clickhouse.cloud/v1/organizations/${ORG_ID:?}/services/${INSTANCE_ID:?}/privateEndpointConfig" | jq .result
451392
```
452393

453394
You should receive a response similar to the following:
@@ -467,19 +408,18 @@ Use the `privateDnsHostname` to connect to your ClickHouse Cloud service using P
467408

468409
### Test DNS setup {#test-dns-setup}
469410

470-
All DNS records from the `${region_code}.privatelink.azure.clickhouse.cloud.` zone should be pointed to the internal IP address from the [*Create a Private Endpoint in Azure*](#create-private-endpoint-in-azure) step. In this example, the region is `westus3`.
471-
472411
Run the following command:
473412

474413
```bash
475-
nslookup abcd.westus3.privatelink.azure.clickhouse.cloud.
414+
nslookup <dns name>
476415
```
416+
where "dns name" `privateDnsHostname`<sup>API</sup> or `DNS name`<sup>console</sup> from [Obtain Azure connection alias for Private Link](#obtain-azure-connection-alias-for-private-link)
477417

478418
You should receive the following response:
479419

480420
```response
481421
Non-authoritative answer:
482-
Name: abcd.westus3.privatelink.azure.clickhouse.cloud
422+
Name: <dns name>
483423
Address: 10.0.0.4
484424
```
485425

@@ -536,8 +476,7 @@ INSTANCE_ID=<Instance ID>
536476
Run the following command to check Private Endpoint filters:
537477

538478
```bash
539-
curl --silent --user ${KEY_ID:?}:${KEY_SECRET:?} -X GET -H "Content-Type: application/json" https://api.clickhouse.cloud/v1/organizations/${ORG_ID:?}/services/${INSTANCE_ID:?} | jq .result.privateEndpointIds
540-
[]
479+
curl --silent --user "${KEY_ID:?}:${KEY_SECRET:?}" -X GET -H "Content-Type: application/json" "https://api.clickhouse.cloud/v1/organizations/${ORG_ID:?}/services/${INSTANCE_ID:?}" | jq .result.privateEndpointIds
541480
```
542481

543482
## More information {#more-information}

0 commit comments

Comments
 (0)