Cloudflare Docs
Durable Objects
Visit Durable Objects on GitHub
Set theme to dark (⇧+D)

Data location

You can restrict a Durable Object to a jurisdiction, or provide a location hint.

​​ Restrict Durable Objects to a jurisdiction

Durable Objects can be created so that they only run and store data within a specific jurisdiction to comply with local regulations such as the GDPR or FedRAMP.

To use a jurisdiction, first create a jurisidictional subnamespace in your Worker’s code:

let subnamespace = OBJECT_NAMESPACE.jurisdiction('eu');

A jurisdictional subnamespace works like a normal Durable Object namespace (OBJECT_NAMESPACE above), except that IDs created within them permanently encode the jurisdiction that was used to create the subnamespace. Additionally, the idFromString() and get() methods will throw an exception if the IDs passed into them are not within the subnamespace’s jurisdiction. Once you have a subnamespace, you can use all of the namespace methods documented above.

To create a new Durable Object ID that will only run and persist data within the jurisdiction:

let id = subnamespace.newUniqueId();

To derive a unique Object ID from the given name string that will only run and persist data within the jurisdiction:

let id = subnamespace.idFromName(name);

To parse a previously-created ID from a string:

let id = subnamespace.idFromString(id);

To obtain an Object:

let durableObjectStub = subnamespace.get(id)

While you cannot use an ID from a different jurisdiction in a subnamespace’s idFromString() or get() methods, you can use any valid ID in the top-level namespace’s methods. Object IDs created with a jurisdiction will still only run and persist data within the jurisdiction.

let id = subnamespace.idFromName(name);
// This is valid.
// And so is this.

Your Workers may still access Durable Objects constrained to a jurisdiction from anywhere in the world. The jurisdiction constraint only controls where the Durable Object itself runs and persists data. Consider using Regional Services to control the regions from which Cloudflare responds to requests.

The currently supported jurisdictions are eu (the European Union) and fedramp (FedRAMP).

​​ Provide a location hint

Durable Objects do not currently move between geographical regions after they are created1. By default, Durable Objects are created close to the first client that accesses them via GET.

To manually create Durable Objects in another location, provide an optional locationHint parameter to GET. Only the first call to GET for a particular Object will respect the hint.

let durableObjectStub = OBJECT_NAMESPACE.get(id, { locationHint: 'enam' });

The following locations are supported. Hints are a best effort and not a guarantee.

Location Hint ParameterLocation
wnamWestern North America
enamEastern North America
samSouth America
weurWestern Europe
eeurEastern Europe
meMiddle East

1 Dynamic relocation of existing Durable Objects is planned for the future.