cdn

I'm trying to understand a bit about traffic costs. I'm planning to serve a big download, probably around 30-40gb. However, I am expecting many users to download that, say from a few hundreds to a few thousands each month. Is there some way to estimate the costs I would have for each amount of monthly downloads?
14 Replies
Chaika
Chaika15mo ago
From R2/Images/Stream? If you're just talking about the normal CDN/proxy, it wouldn't be allowed unless on Enterprise:
Cloudflare’s content delivery network (the “CDN”) Service can be used to cache and serve web pages and websites. Unless you are an Enterprise customer, Cloudflare offers specific Paid Services (e.g., the Developer Platform, Images, and Stream) that you must use in order to serve video and other large files via the CDN. Cloudflare reserves the right to disable or limit your access to or use of the CDN, or to limit your End Users’ access to certain of your resources through the CDN, if you use or are suspected of using the CDN without such Paid Services to serve video or a disproportionate percentage of pictures, audio files, or other large files. We will use reasonable efforts to provide you with notice of such action.
https://www.cloudflare.com/service-specific-terms-application-services/#content-delivery-network-terms
Hello, I’m Allie!
If it is with R2, it would cost about $0.45/month Given no writes
EyalAmir
EyalAmirOP15mo ago
Thank you! I'm open to all options, and certainly happy to pay for the service. The files are specific data files used in our apps, so they aren't images or videos, but they are pretty large. Thank you! Is that the cost for storage? Or traffic?
Hello, I’m Allie!
Just storage. Requests are free up to 10 million requests a month
Chaika
Chaika15mo ago
There's no bandwidth costs with R2 (Cloudflare's Generic s3-compat storage), you just pay a flat rate per request
EyalAmir
EyalAmirOP15mo ago
Ah! So is it 0.45 per gb stored?
Chaika
Chaika15mo ago
I probably should have clarified: R2 = Cloudflare's S3 compat storage Cloudflare Images = Image pipeline & storage Cloudflare Stream = Stream/video pipeline & storage Images/Stream have a bunch of features for that specific content type like Images allows image variants and uploading from a user app, Stream renders the video, etc. They're end-to-end solutions, where R2 is just generic file storage R2 pricing is here: https://developers.cloudflare.com/r2/pricing/ Getting an Object is a class B It's $0.015 / GB-month per gb stored
Pricing · Cloudflare R2 docs
R2 charges based on the total volume of data stored, along with two classes of operations on that data:
EyalAmir
EyalAmirOP15mo ago
Brilliant, thank you. So I think R2 is what we want - this is only meant for data provided by us to users, and not user data. So the usage is probably very rare write operations, and very common read operations. Are requests just a singular http request? For example if one user downloads one large file, is that just one request?
Chaika
Chaika15mo ago
It's just one Class B if they only need one request to download it (Videos use range requests in some cases, for example, which would be multiple). Additionally, if it's a bucket on a custom domain, any requests which hit cache don't count as a Class B
EyalAmir
EyalAmirOP15mo ago
Alright, thank you so much for that information! I have another question: I've just signed up to the R2 instance, but I can't find docs about how to upload files with the command line?
Chaika
Chaika15mo ago
https://developers.cloudflare.com/r2/objects/upload-objects/ There are docs here, you can use Wrangler (Cloudflare's cli) to do it, but only for files up to 315 MB For files larger then that, get yourself setup with rclone: https://developers.cloudflare.com/r2/examples/rclone/ It uses R2's s3-compat API and works great for files of any size, up to R2's 5 TiB max. Rclone is great in general for management, can even mount r2 as a local drive
EyalAmir
EyalAmirOP15mo ago
Thank you so much for your help. I'm trying to set up rclone, and this is my config file:
[modalics]
type = s3
provider = Cloudflare
access_key_id = {actual_key_id}
secret_access_key = {actual_access_key}
endpoint = https://{account_id}.r2.cloudflarestorage.com
region = auto
acl = private
[modalics]
type = s3
provider = Cloudflare
access_key_id = {actual_key_id}
secret_access_key = {actual_access_key}
endpoint = https://{account_id}.r2.cloudflarestorage.com
region = auto
acl = private
Then I call:
rclone lsf modalics:
rclone lsf modalics:
But I'm getting Access Denied. I think it's possible that I took the account ID from the wrong place? The only place I've found something that could be it was in in the URL for my account, where should it be?
Chaika
Chaika15mo ago
When you click on a bucket and go to settings, it shows you the url you should use, minus the bucket name Or just in the R2 tab, on the right side, you can see your accountid Make sure you generated the token from the R2 Tab -> R2 API Tokens as well, and gave it the right permissions
EyalAmir
EyalAmirOP15mo ago
Yeah, that's exactly the account ID I used. I think the key has the right permissions but I'll double check. Thank you so much, this works great.

Did you find this page helpful?