Skip to content

Commit 12ee433

Browse files
authored
Merge pull request #33257 from ptravers/9549
[sql_server] doc: add aws privatelink to self hosted
2 parents 8e5b4ed + cd2d3ef commit 12ee433

File tree

1 file changed

+121
-0
lines changed

1 file changed

+121
-0
lines changed

doc/user/content/ingest-data/sql-server/self-hosted.md

Lines changed: 121 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,123 @@ Select the option that works best for you.
7070
7171
{{< /tab >}}
7272
73+
{{< tab "Use AWS PrivateLink">}}
74+
75+
Materialize can connect to a SQL Server database through an [AWS PrivateLink](https://aws.amazon.com/privatelink/)
76+
service. Your SQL Server database must be running on AWS in order to use this
77+
option.
78+
79+
1. #### Create a target group
80+
81+
Create a dedicated [target group](https://docs.aws.amazon.com/elasticloadbalancing/latest/network/create-target-group.html)
82+
for your SQL Server instance with the following details:
83+
84+
a. Target type as **IP address**.
85+
86+
b. Protocol as **TCP**.
87+
88+
c. Port as **1433**, or the port that you are using in case it is not 1433.
89+
90+
d. Make sure that the target group is in the same VPC as the SQL Server
91+
instance.
92+
93+
e. Click next, and register the respective SQL Server instance to the target
94+
group using its IP address.
95+
96+
1. #### Create a Network Load Balancer (NLB)
97+
98+
Create a [Network Load Balancer](https://docs.aws.amazon.com/elasticloadbalancing/latest/network/create-network-load-balancer.html)
99+
that is **enabled for the same subnets** that the SQL Server instance is
100+
in.
101+
102+
1. #### Create TCP listener
103+
104+
Create a [TCP listener](https://docs.aws.amazon.com/elasticloadbalancing/latest/network/create-listener.html)
105+
for your SQL Server instance that forwards to the corresponding target
106+
group you created.
107+
108+
1. #### Verify security groups and health checks
109+
110+
Once the TCP listener has been created, make sure that the [health checks](https://docs.aws.amazon.com/elasticloadbalancing/latest/network/target-group-health-checks.html)
111+
are passing and that the target is reported as healthy.
112+
113+
If you have set up a security group for your SQL Server instance, you must
114+
ensure that it allows traffic on the health check port.
115+
116+
**Remarks**:
117+
118+
a. Network Load Balancers do not have associated security groups. Therefore,
119+
the security groups for your targets must use IP addresses to allow
120+
traffic.
121+
122+
b. You can't use the security groups for the clients as a source in the
123+
security groups for the targets. Therefore, the security groups for your
124+
targets must use the IP addresses of the clients to allow traffic. For more
125+
details, check the [AWS documentation](https://docs.aws.amazon.com/elasticloadbalancing/latest/network/target-group-register-targets.html).
126+
127+
1. #### Create a VPC endpoint service
128+
129+
Create a VPC [endpoint service](https://docs.aws.amazon.com/vpc/latest/privatelink/create-endpoint-service.html)
130+
and associate it with the **Network Load Balancer** that you’ve just
131+
created.
132+
133+
Note the **service name** that is generated for the endpoint service.
134+
135+
**Remarks**:
136+
137+
By disabling [Acceptance Required](https://docs.aws.amazon.com/vpc/latest/privatelink/configure-endpoint-service.html#accept-reject-connection-requests),
138+
while still strictly managing who can view your endpoint via IAM,
139+
Materialze will be able to seamlessly recreate and migrate endpoints as we
140+
work to stabilize this feature.
141+
142+
1. #### Create an AWS PrivateLink Connection
143+
144+
In Materialize, create a [`AWS PRIVATELINK`](/sql/create-connection/#aws-privatelink) connection that references the
145+
endpoint service that you created in the previous step.
146+
147+
```mzsql
148+
CREATE CONNECTION privatelink_svc TO AWS PRIVATELINK (
149+
SERVICE NAME 'com.amazonaws.vpce.<region_id>.vpce-svc-<endpoint_service_id>',
150+
AVAILABILITY ZONES ('use1-az1', 'use1-az2', 'use1-az3')
151+
);
152+
```
153+
154+
Update the list of the availability zones to match the ones that you are
155+
using in your AWS account.
156+
157+
1. #### Configure the AWS PrivateLink service
158+
159+
Retrieve the AWS principal for the AWS PrivateLink connection you just
160+
created:
161+
162+
```mzsql
163+
SELECT principal
164+
FROM mz_aws_privatelink_connections plc
165+
JOIN mz_connections c ON plc.id = c.id
166+
WHERE c.name = 'privatelink_svc';
167+
```
168+
169+
```
170+
principal
171+
---------------------------------------------------------------------------
172+
arn:aws:iam::664411391173:role/mz_20273b7c-2bbe-42b8-8c36-8cc179e9bbc3_u1
173+
```
174+
175+
Follow the instructions in the [AWS PrivateLink documentation](https://docs.aws.amazon.com/vpc/latest/privatelink/add-endpoint-service-permissions.html)
176+
to configure your VPC endpoint service to accept connections from the
177+
provided AWS principal.
178+
179+
If your AWS PrivateLink service is configured to require acceptance of
180+
connection requests, you must manually approve the connection request from
181+
Materialize after executing the `CREATE CONNECTION` statement. For more
182+
details, check the [AWS PrivateLink documentation](https://docs.aws.amazon.com/vpc/latest/privatelink/configure-endpoint-service.html#accept-reject-connection-requests).
183+
184+
**Note:** It might take some time for the endpoint service connection to
185+
show up, so you would need to wait for the endpoint service connection to
186+
be ready before you create a source.
187+
188+
{{< /tab >}}
189+
73190
{{< tab "Use an SSH tunnel">}}
74191
75192
To create an SSH tunnel from Materialize to your database, you launch an VM to
@@ -131,6 +248,10 @@ networking configuration, so start by selecting the relevant option.
131248
{{% sql-server-direct/ingesting-data/allow-materialize-ips %}}
132249
{{< /tab >}}
133250
251+
{{< tab "Use an AWS Privatelink">}}
252+
{{% sql-server-direct/ingesting-data/use-aws-privatelink %}}
253+
{{< /tab >}}
254+
134255
{{< tab "Use an SSH tunnel">}}
135256
{{% sql-server-direct/ingesting-data/use-ssh-tunnel %}}
136257
{{< /tab >}}

0 commit comments

Comments
 (0)