Blog Details

blog
about

Data Residency Is an Architecture Problem

Data Residency Is an Architecture Problem

A data residency question rarely starts in engineering. It arrives from procurement, usually as one line in a security questionnaire: where is our data stored. Someone answers with a cloud region, the answer goes into a contract, and everyone moves on. Six months later an auditor asks where the trace spans go and the room goes quiet.

The region is the easy part, and it is the only part most architecture diagrams draw. Residency fails in the places the diagram leaves out.

What a residency commitment actually covers

Choosing a region answers one question: where the primary database sits. A residency commitment answers four. Where the data is stored, where it is processed, who can reach it, and where the copies end up. Procurement contracts now name all four. Engineering plans usually address the first.

Data moves without anyone deciding to move it. A support engineer in Toronto opens a production session to debug a tenant in Frankfurt. A nightly job ships records to a warehouse in Virginia. A vendor SDK calls whichever endpoint the vendor picked. None of that is malicious. All of it counts as a transfer, and the customer finds out from your own questionnaire answers.

Canadian rules work on accountability rather than adequacy. PIPEDA does not ban sending personal information to another country for processing, and it keeps no list of approved destinations. It keeps the original organization responsible for what happens after the data leaves. The Privacy Commissioner's 2009 guidance on transborder processing still says the same thing: you can outsource the processing, not the accountability.

Quebec runs a stricter model. Since September 2023, Law 25 requires a privacy impact assessment before personal information is communicated outside Quebec, plus a written agreement that reflects what the assessment found. The law follows Quebec residents rather than Quebec companies. Sell into Montreal with your stack in Ohio and you owe someone a documented assessment.

Four patterns and what each one costs

Pooled per region

Every tenant in a region shares one database cluster. EU tenants land in a PostgreSQL instance in Frankfurt, North American tenants in one in Montreal, and every query carries a tenant filter enforced by row level security. It is the cheapest way to get geographic separation and the one most teams start with.

Two things break it. A policy line gets dropped during a migration and one tenant's rows become visible to another, which is a breach rather than a compliance finding. And the evidence is weak, because isolation is logical. An auditor asking whether tenant data could physically coexist with another tenant's gets an honest yes.

Regional cells

A cell is a complete stack per region: application, database, object storage, search, queues, caches. Each tenant belongs to one cell and never crosses. Incident blast radius shrinks, latency improves, and the residency story is easy to defend because the boundary is physical.

The cost lands in operations. Two cells mean two deploy pipelines, two sets of dashboards, two upgrade windows, and a drift problem that starts the week after launch. Cells make sense once deployment is fully automated. Teams that build the second cell before the pipeline exists end up with a snowflake they are afraid to touch.

Global control plane, regional data plane

This is where most vendors land. Authentication, tenant metadata, billing and telemetry stay global. Customer content, processing and model inference stay in region. It keeps one login and one admin console while giving customers the answer they need about their records.

The cost is a definition that has to survive every feature review. Someone will propose storing a customer's email in the global tenant table because it makes the admin search faster, and now your control plane holds personal data. The pattern works only if the line is written down and tested, not just agreed in a design meeting.

One region, documented limits

Sometimes the right answer is a single region and an honest statement about what you cannot support. That answer closes certain deals, and it also stops you from promising a Frankfurt deployment you cannot operate, which is the worse outcome.

Where residency actually leaks

The region setting holds. The surrounding services are where the commitment breaks, and each one has a default that nobody chose.

  • Observability. Traces and error reports capture request bodies, headers and user identifiers, then ship them to a vendor with its own regional footprint. Check whether your SDK sends to a US endpoint regardless of where the app runs.
  • Backups. Managed databases replicate snapshots and point in time recovery logs to a paired region by default. That pairing is chosen for disaster recovery, not for your contract.
  • Search and cache. A read replica or a search index rebuilt from production data is a copy, and copies count. So does the snapshot you took before the index rebuild.
  • Queues. Dead letter topics hold failed payloads for days. They are often the least monitored store in the system and the most likely to contain raw personal data.
  • Email and SMS. Transactional providers process message content and recipient addresses. A provider with global routing means a Canadian customer's address may be processed outside Canada.
  • Model inference. An AI feature that sends a support transcript to a hosted model is processing personal data in whatever region that model runs. Region-pinned inference is now a real product decision, not a detail.
  • Support access. Screen sharing and remote sessions are access, not storage, but most contracts cover both. Log them, and make the log reviewable.
  • Staging and CI. A production dump restored into a staging environment in another region creates a full copy of the data with weaker controls. It is also the easiest leak to prove, which makes it a bad one to leave open in a review.
  • Analytics and session replay. Product analytics tools record clicks, page content and sometimes form fields. Session replay can capture more than the application database ever stores.

Most of these are configuration decisions rather than redesigns. They still need an inventory and a call on each service, which is dull work that does not fit in a sprint demo.

Make the tenant map a real object

Tenant to region has to be data in a table, not a value in a config file. Once it is a table, it can drive request routing, select the encryption key, choose the backup bucket, and tell the admin console which cell to query. When it lives in a config file, every new service hardcodes an assumption and the map rots.

The second move is narrowing what counts as in-scope data. Most rows are not personal information. A product SKU, a price, a warehouse code and an inventory count can live anywhere. Names, addresses, payment tokens, support notes and order history tied to a person cannot. Pinning the whole database is expensive. Pinning the personal columns and keeping the catalog global is affordable, and it is usually enough to satisfy the assessment.

That classification also decides your encryption boundary. A key created in one region cannot decrypt in another, which is a feature. Keep keys per region and give the application a reference rather than the material. The anti-pattern is a central key service that decrypts everything on behalf of every region, because that puts the plaintext back in one place and undoes the work.

Routing at the edge, identity in the middle

Edge routing is the easy half. Resolve the tenant, pick the region, forward the request. Identity is harder. A global login means session data crosses regions, and a session token is personal data if it carries an email or a name inside a readable claim. Keep the token opaque, keep the profile in region, and accept one extra lookup.

The same rule applies to admin tooling. A single console that queries every cell is convenient and it is also a global processor sitting in the middle of a regional promise. Either run the console per region or make it a control plane that only sends commands and never returns record content.

Prove it instead of describing it

Security questionnaires ask for evidence, and the teams that answer quickly keep four artifacts ready. A restore performed inside the target region, with the timestamp and the operator named. An access log review showing who touched the EU database in the last quarter. A subprocessor inventory diffed against the signed agreement. And a query that fails when it is run against the wrong region, because a control that has never blocked anything is a hypothesis.

That last one is worth building into the test suite. Attempt a cross-region read for a pinned tenant and assert the failure. If the test passes only because nobody tried, it is not a control.

A migration path you can actually run

Moving an existing tenant into a region is a different problem from building for one. Per-database forks look clean until the database is shared. The workable path is per-tenant export and import: identify the tenant's rows across every store, export them to a staging bucket in the target region, import, verify counts and checksums, then flip the map entry and cut traffic.

Dual writes sound safer and usually are not. Two writable copies create a reconciliation problem you will be debugging for months. A short freeze window with a verified cutover is easier to explain to a customer than eventual consistency across a legal boundary.

Start with the largest tenant, not the smallest. The largest exposes every hardcoded assumption and every missing foreign key. Doing it first is unpleasant and it is the only way to know the timeline is real.

The next two weeks

  • Write the region map down, including tenants that have no region yet.
  • List every third-party endpoint that receives a payload containing a name, address, email, token or free text field.
  • Check the default replication targets for backups, read replicas and search snapshots.
  • Run one restore inside the region you promise, and time it.
  • Update the subprocessor list in the agreement to match what the system actually calls.

Residency is a routing property plus an evidence problem. The architecture decides whether you can make the promise, and the inventory decides whether you can prove you kept it. None of it is especially difficult. Most of it is already possible in the tools you run today, and what tends to be missing is the record of what you decided and why.

Send Us a Message