Guides / Customer data export on Cloudflare D1 and R2 for EU Data ...
Art. 25, Art. 26(b), Art. 28, Art. 29Customer data export on Cloudflare D1 and R2 for EU Data Act switching
Design customer switching on Cloudflare Workers, D1 SQLite, and R2 object storage with the Article 29 switching charge rules in mind.
Key facts
| Platform | Cloudflare Workers + D1 + R2 |
| Egress Economics | R2 has no egress fees, which removes a cost you might otherwise pass on. Compliance depends on not charging customers for switching (Art. 29). |
| Binding Safety | Use env.DB.prepare().bind(tenantId) exclusively |
| Data Locality | Document D1 jurisdiction hint (e.g. WEUR) in Art. 28 register |
Options compared
| Component | Isolation Pattern | EU Data Act Role |
|---|---|---|
| Cloudflare D1 | Prepared statements with ? binding | Structured CSV / NDJSON export |
| Cloudflare R2 | Key prefix tenants/<tenant_id>/ | Zero-egress binary asset retrieval |
| Workers + pdf-lib | Canonical SHA-256 digest | Operator-attested PDF Certificate of Erasure |
1. Use R2 to Avoid Passing On Egress Costs
Because Cloudflare R2 charges no data egress fees, exports from R2 add no bandwidth cost that you might otherwise pass on to a switching customer. What you may charge is set by Art. 29: cost-based switching charges only until January 12, 2027 and none after that date.
Paginate R2 list() calls with cursor tokens and write manifest entries with each object's ETag or SHA-256 digest.
Cloudflare D1 + R2 tenant export snippet
const rows = await env.DB.prepare("SELECT * FROM documents WHERE tenant_id = ?")
.bind(tenantId)
.all();
const objects = await env.STORAGE.list({ prefix: `tenants/${tenantId}/` });Close the gaps
The kit gives you the public Art. 26 and Art. 28 pages, code to export a customer's data, and a tracker for switching deadlines.