Hello, i’m really new to cloudflare and i’m really intrigued to try cloudflare r2 because of free egress. I’m going to use r2 to host game files, where i can provide game asset to user via in game download feature (video, image, script, text, 3d model, etc).
But im having confusion on how to setup public bucket. I read the documentation that my bucket can either be made public using r2.dev, or i need to create custom domain. However r2.dev is rate limited so the only practical way to make my bucket public is to use custom domain, where can i create custom domain? do i need to buy custom domain for it or cloudflare provide one for free ? if i need to buy custom domain, does cloudflare sell very cheap custom domain just for the purpose of making the bucket public ?
And suppose i have custom domain, how does the data transfer from r2 server to user work ? which one below represent the data transfer flow?:
(1) r2 server transfer the data to custom domain server, and then custom domain server transfer data to client
(2) custom domain server redirect to r2 bucket, which then r2 server transfer directly to client?
(3) other ???
If (1) is the case, then i guess it is pointless to use r2 to host file because i need r2 for the bandwidth not for the storage, amazon s3 would be a better platform. If the case is (2), how exactly do i setup my bucket url with my custom domain ??
I’m sorry if this sounds like a newbie question, but i’m having a hard time trying to wrap my head around r2 bucket system. Please help.
Thanks for the reply. So i need to buy domain, then setup cloudflare zone, then rent cloudflare worker, only after all that hidden cost i can finally make my bucket accessible from internet. I was guessing that free egress is too good to be true, i was right .
But it can potentially still be cheaper than amazon s3 depending on cloudflare worker, or to be precise, how many CPU milisecond does cloudflare worker takes to deliver file from R2 ? this is important because R2 file need to go through cloudflare worker, and cloudflare worker charge user based on cpu time.
Does cloudflare worker only take milisecond cpu time to execute request regardless of R2 file size, or does the cpu time used by cloudflare worker is equivalent to the time needed to transfer file ? For example, if a user need 15 minutes to download 1gb file from R2 through cloudflare worker, does cloudflare worker charges milisecond cpu time to execute the request, or does it charge 15 minutes cpu time?
The answer to question above is necessary to calculate the true cost to host file in R2. If you dont mind, can you please help me answer these question ? sorry for deviating from the post title, i already figured out how to make the bucket public, now i just need to calculate the cost.
Wait really, how ? So all i need to make my bucket public was just cloudflare domain and cloudflare zone? The tutorial i was following uses cloudflare worker, how do i setup the bucket public with just domain ? If what you say is true, then it is a huge thing!!! so i can basically host my game file with
very small price per year (by buying the cheapest domain and keeping the game file size low).