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: D1 can restrict data localization with jurisdictions
3
+
description: A D1 database can set a jurisdiction at creation, which limits the location to run and store the database.
4
+
products:
5
+
- d1
6
+
- workers
7
+
date: 2025-10-05
8
+
---
9
+
10
+
You can now set a [jurisdiction](/d1/configuration/data-location/) when creating a D1 database to guarantee where your database runs and stores data. Jurisdictions can help you comply with data localization regulations such as GDPR. Supported jurisdictions include `eu` and `fedramp`.
11
+
12
+
A jurisdiction can only be set at database creation time via wrangler, REST API or the UI and cannot be added/updated after the database already exists.
13
+
14
+
```sh
15
+
npx wrangler@latest d1 create db-with-jurisdiction --jurisdiction eu
16
+
```
17
+
18
+
```
19
+
curl -X POST "https://api.cloudflare.com/client/v4/accounts/<account_id>/d1/database" \
Copy file name to clipboardExpand all lines: src/content/docs/d1/configuration/data-location.mdx
+52-6Lines changed: 52 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -7,12 +7,55 @@ sidebar:
7
7
8
8
import { DashButton } from"~/components";
9
9
10
-
Learn how the location of data stored in D1 is determined, including where the leader is placed and how you optimize that location based on your needs.
10
+
Learn how the location of data stored in D1 is determined, including where the database runs and how you optimize that location based on your needs.
11
11
12
12
## Automatic (recommended)
13
13
14
14
By default, D1 will automatically create your primary database instance in a location close to where you issued the request to create a database. In most cases this allows D1 to choose the optimal location for your database on your behalf.
15
15
16
+
## Restrict database to a jurisdiction
17
+
18
+
Jurisdictions are used to create D1 databases that only run and store data within a region to help comply with data locality regulations such as the [GDPR](https://gdpr-info.eu/) or [FedRAMP](https://blog.cloudflare.com/cloudflare-achieves-fedramp-authorization/).
19
+
20
+
Workers may still access the database constrained to a jurisdiction from anywhere in the world. The jurisdiction constraint only controls where the database itself runs and persists data. Consider using [Regional Services](/data-localization/regional-services/) to control the regions from which Cloudflare responds to requests.
21
+
22
+
:::note
23
+
24
+
Jurisdictions can only be set on database creation and cannot be added or updated after the database exists. If a jurisdiction and a location hint are both provided, the jurisdiction takes precedence and the location hint is ignored.
25
+
:::
26
+
27
+
### Supported jurisdictions
28
+
29
+
| Parameter | Location |
30
+
| --------- | ------------------------------ |
31
+
| eu | The European Union |
32
+
| fedramp | FedRAMP-compliant data centers |
33
+
34
+
### Use the dashboard
35
+
36
+
1. In the Cloudflare dashboard, go to the **D1 SQL Database** page.
37
+
38
+
<DashButtonurl="/?to=/:account/workers/d1" />
39
+
40
+
2. Select **Create Database**.
41
+
3. Under **Data location**, select **Specify jurisdiction** and choose a jurisdiction from the list.
Location hint is an optional parameter you can provide to indicate your desired geographical location for your primary database instance.
@@ -32,10 +75,10 @@ Provide a location hint when creating a D1 database when:
32
75
Providing a location hint does not guarantee that D1 runs in your preferred location. Instead, it will run in the nearest possible location (by latency) to your preference.
33
76
:::
34
77
35
-
### Use Wrangler
78
+
### Use wrangler
36
79
37
80
:::note
38
-
To install Wrangler, the command-line interface for D1 and Workers, refer to [Install and Update Wrangler](/workers/wrangler/install-and-update/).
81
+
To install wrangler, the command-line interface for D1 and Workers, refer to [Install and Update Wrangler](/workers/wrangler/install-and-update/).
39
82
:::
40
83
41
84
To provide a location hint when creating a new database, pass the `--location` flag with a valid location hint:
To provide a location hint when creating a database via the dashboard:
50
93
51
-
1. In the Cloudflare dashboard, go to the **D1** page.
94
+
1. In the Cloudflare dashboard, go to the **D1 SQL Database** page.
52
95
53
96
<DashButtonurl="/?to=/:account/workers/d1" />
97
+
54
98
2. Select **Create database**.
55
99
3. Provide a database name and an optional **Location**.
56
100
4. Select **Create** to create your database.
57
101
58
-
## Available location hints
102
+
###Available location hints
59
103
60
104
D1 supports the following location hints:
61
105
@@ -78,4 +122,6 @@ With read replication enabled, D1 creates and distributes read-only copies of th
78
122
79
123
When using D1 read replication, D1 automatically creates a read replica in [every available region](/d1/configuration/data-location#available-location-hints), including the region where the primary database instance is located.
80
124
81
-
Refer to [D1 read replication](/d1/best-practices/read-replication/) for more information.
125
+
If a jurisdiction is configured, read replicas are only created within the jurisdiction set on database creation.
126
+
127
+
Refer to [D1 read replication](/d1/best-practices/read-replication/) for more information.
0 commit comments