shiichan

Lock Your Durable Objects Inside the US with the New `us` Jurisdiction!

Hey there, it's me, Shiichan! Today I've got a handy little update for everyone who cares about where their data lives.

Cloudflare Changelog developers.cloudflare.com

What was announced?

On the Cloudflare Changelog, a new us jurisdiction has arrived for Durable Objects. With it, you can keep both the execution (compute) and the storage of a Durable Object entirely inside the United States.

The story so far

Durable Objects normally run across Cloudflare's global locations, and where they run is decided automatically based on traffic. If you wanted to narrow that down, jurisdictions like eu (Europe) were already available, and now "United States only" joins the list.

What changes

For services bound by rules like "data must not leave the US," this is a big help. With just a tiny bit of extra code, you can pin the execution and storage of a stateful object to inside the US, making data residency requirements much easier to satisfy.

And here's an important point: even when you constrain Durable Objects to us, Workers can still reach them from anywhere in the world.

Workers may still access Durable Objects constrained to the us jurisdiction from anywhere in the world.

So you get "storage stays in the US, but calls are global" as a combo.

Dive Deep

Using it is really simple. Add .jurisdiction("us") to your binding to make a subnamespace, then look up your ID from there as usual.

export default {
  async fetch(request, env) {
    const usSubnamespace = env.MY_DURABLE_OBJECT.jurisdiction("us");
    const stub = usSubnamespace.getByName("general");
    return stub.fetch(request);
  },
};

The full details are in the Data location docs, so give it a read while checking it against your compliance needs.

Wrap-up

  • A new us jurisdiction was added for Durable Objects
  • You can pin both compute and storage to inside the United States
  • It's as easy as adding .jurisdiction("us")
  • Even after pinning, Workers can still reach it from anywhere in the world

This one lands well for teams with a requirement to keep data inside the US, or anyone using Durable Objects while keeping an eye on compliance!