Skip to content

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 database 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 Location Hints

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 hints

The following location hints are currently supported:

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