You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
title: Automatic configuration for private databases on Hyperdrive
3
+
description: Hyperdrive now automatically configures your Cloudflare Tunnel to connect to your private database.
4
+
products:
5
+
- hyperdrive
6
+
date: 2025-01-28T18:00:00Z
7
+
---
8
+
9
+
Hyperdrive now automatically configures your Cloudflare Tunnel to connect to your private database.
10
+
11
+

12
+
13
+
When creating a Hyperdrive configuration for a private database, you only need to provide your database credentials and set up a Cloudflare Tunnel within the private network where your database is accessible. Hyperdrive will automatically create the Cloudflare Access, Service Token, and Policies needed to secure and restrict your Cloudflare Tunnel to the Hyperdrive configuration.
14
+
15
+
To create a Hyperdrive for a private database, you can follow the [Hyperdrive documentation](/hyperdrive/configuration/connect-to-private-database/). You can still manually create the Cloudflare Access, Service Token, and Policies if you prefer.
16
+
17
+
This feature is available from the Cloudflare dashboard.
title: Hyperdrive automatically configures your Cloudflare Tunnel to connect to your private database.
10
+
description: |-
11
+
When creating a Hyperdrive configuration for a private database, you only need to provide your database credentials and set up a Cloudflare Tunnel within the private network where your database is accessible.
12
+
13
+
Hyperdrive will automatically create the Cloudflare Access, Service Token and Policies needed to secure and restrict your Cloudflare Tunnel to the Hyperdrive configuration.
14
+
15
+
Refer to [documentation on how to configure Hyperdrive to connect to a private database](/hyperdrive/configuration/connect-to-private-database/).
8
16
- publish_date: "2024-12-11"
9
17
title: Hyperdrive now caches queries in all Cloudflare locations decreasing cache hit latency by up to 90%
Copy file name to clipboardExpand all lines: src/content/docs/hyperdrive/configuration/connect-to-private-database.mdx
+28-4Lines changed: 28 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -58,7 +58,29 @@ Your tunnel must be configured to use a public hostname so that Hyperdrive can r
58
58
If you are setting up the tunnel through the CLI instead ([locally-managed tunnel](/cloudflare-one/connections/connect-networks/configure-tunnels/local-management/)), you will have to complete these steps manually. Follow the Cloudflare Zero Trust documentation to [add a public hostname to your tunnel](/cloudflare-one/connections/connect-networks/routing-to-tunnel/dns/) and [configure the public hostname to route to the address of your database](/cloudflare-one/connections/connect-networks/configure-tunnels/local-management/configuration-file/).
59
59
:::
60
60
61
-
## 2. Create a service token
61
+
## 2. Create and configure Hyperdrive to connect to the Cloudflare Tunnel
62
+
63
+
To restrict access to the Cloudflare Tunnel to Hyperdrive, a [Cloudflare Access application](/cloudflare-one/applications/) must be configured with a [Policy](/cloudflare-one/policies/) that requires requests to contain a valid [Service Auth token](/cloudflare-one/policies/access/#service-auth).
64
+
65
+
The Cloudflare dashboard can automatically create and configure the underlying [Cloudflare Access application](/cloudflare-one/applications/), [Service Auth token](/cloudflare-one/policies/access/#service-auth), and [Policy](/cloudflare-one/policies/) on your behalf. Alternatively, you can manually create the Access application and configure the Policies.
66
+
67
+
<Tabs> <TabItemlabel="Automatic creation">
68
+
69
+
### 2.1 Create a Hyperdrive configuration in the Cloudflare dashboard
70
+
71
+
Create a Hyperdrive configuration in the Cloudflare dashboard to automatically configure Hyperdrive to connect to your Cloudflare Tunnel.
72
+
73
+
1. In the [Cloudflare dashboard](https://dash.cloudflare.com/?to=/:account/workers/hyperdrive), navigate to **Storage & Databases > Hyperdrive** and click **Create configuration**.
74
+
2. Select **Private database**.
75
+
3. In the **Networking details** section, select the tunnel you are connecting to.
76
+
4. In the **Networking details** section, select the hostname associated to the tunnel. If there is no hostname for your database, return to step [1.2. Connect your database using a public hostname](/hyperdrive/configuration/connect-to-private-database/#12-connect-your-database-using-a-public-hostname).
77
+
5. In the **Access Service Authentication Token** section, select **Create new (automatic)**.
78
+
6. In the **Access Application** section, select **Create new (automatic)**.
79
+
7. In the **Database connection details** section, enter the database **name**, **user**, and **password**.
80
+
81
+
</TabItem>
82
+
<TabItemlabel="Manual creation">
83
+
### 2.1 Create a service token
62
84
63
85
The service token will be used to restrict requests to the tunnel, and is needed for the next step.
64
86
@@ -78,7 +100,7 @@ The service token will be used to restrict requests to the tunnel, and is needed
78
100
This is the only time Cloudflare Access will display the Client Secret. If you lose the Client Secret, you must regenerate the service token.
79
101
:::
80
102
81
-
##3. Create an Access application to secure the tunnel
103
+
### 2.2 Create an Access application to secure the tunnel
82
104
83
105
[Cloudflare Access](/cloudflare-one/policies/access/) will be used to verify that requests to the tunnel originate from Hyperdrive using the service token created above.
84
106
@@ -116,7 +138,7 @@ The service token will be used to restrict requests to the tunnel, and is needed
116
138
117
139
17. Save the application.
118
140
119
-
##4. Create a Hyperdrive configuration
141
+
### 2.3 Create a Hyperdrive configuration
120
142
121
143
To create a Hyperdrive configuration for your private database, you'll need to specify the Access application and Cloudflare Tunnel information upon creation.
122
144
@@ -158,7 +180,9 @@ In addition, it will also set the Access Client ID and the Access Client Secret
158
180
When creating the Hyperdrive configuration for the private database, you must enter the `access-client-id` and the `access-client-id`, and omit the `port`. Hyperdrive will route database messages to the public hostname of the tunnel, and the tunnel will rely on its service configuration (as configured in [1.2. Connect your database using a public hostname](#12-connect-your-database-using-a-public-hostname)) to route requests to the database within your private network.
159
181
:::
160
182
161
-
## 5. Query your Hyperdrive configuration from a Worker (optional)
183
+
</TabItem> </Tabs>
184
+
185
+
## 3. Query your Hyperdrive configuration from a Worker (optional)
162
186
163
187
To test your Hyperdrive configuration to the database using Cloudflare Tunnel and Access, use the Hyperdrive configuration ID in your Worker and deploy it.
0 commit comments