Skip to content
Cloudflare Docs

Data location

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.

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.

Provide a location hint

Location hint is an optional parameter you can provide to indicate your desired geographical location for your primary database instance.

You may want to explicitly provide a location hint in cases where the majority of your writes to a specific database come from a different location than where you are creating the database from. Location hints can be useful when:

  • Working in a distributed team.
  • Creating databases specific to users in specific locations.
  • Using continuous deployment (CD) or Infrastructure as Code (IaC) systems to programmatically create your databases.

Provide a location hint when creating a D1 database when:

Use Wrangler

To provide a location hint when creating a new database, pass the --location flag with a valid location hint:

Terminal window
wrangler d1 create new-database --location=weur

Use the dashboard

To provide a location hint when creating a database via the dashboard:

  1. Log in to the Cloudflare dashboard and select your account.
  2. Go to Workers & Pages > D1.
  3. Select Create database.
  4. Provide a database name and an optional Location.
  5. Select Create to create your database.

Available location hints

D1 supports the following location hints:

HintHint description
wnamWestern North America
enamEastern North America
weurWestern Europe
eeurEastern Europe
apacAsia-Pacific
ocOceania

Read replica locations

With read replication enabled, D1 creates and distributes read-only copies of the primary database instance around the world. This reduces the query latency for users located far away from the primary database instance.

When using D1 read replication, D1 automatically creates a read replica in every available region, including the region where the primary database instance is located.

Refer to D1 read replication for more information.