we are currently implement a open api using worker to retrieve objects from r2.
the scenario is as follows:
1, we have two Cloudflare accounts A and B.
2, B has published a workerB and a r2 bucket: bucketB.
3, In workerB, it allows retrieve object from bucketB
4, Now we have another workerA from account A.
5, In workerA, it will call workerB to retrieve the Object.
so the route looks like: browser → workerA → workerB → bucketB
In this scenario, both Account A and Account B will be billed for their respective Worker executions. Account A will be billed for Worker A’s executions (browser → Worker A), and Account B will be billed for Worker B’s executions (Worker A → Worker B). However, only Account B will be billed for usage of the R2 storage bucket, since only Worker B is accessing it.
thx albert.
And how about the traffic there? Originally r2 does not charge for egress traffic.
But we wonder how it goes when using worker api.
As we are try to offer a download service.
the traffic goes from bucketB → workerB → workerA → browser.
will the traffic also be charged for workerB and workerA?
There is no egress charge for Workers. Workers are billed only by number of invocations (and duration if using Unbound, but you shouldn’t be when just serving files).