Elastic CloudFlare Stream Storage

Hey there,

I’m operating a large video service and I’m finding I need to constantly go into my CloudFlare Stream settings and increase the storage amount multiple times per month.

Is there a way I can set this to be “elastic”, as in it will expand forever and automatically bill me? Or is there an API somewhere that I can check how much storage I have left, how much is used, and an API call I can make to expand it when it gets low? Happy to work with APIs if that exists, but having an “auto elastic” option would be so much better.

Thank you,

Kalob

I don’t think there’s an API option for this. Looking at my dashboard, it gives me 1000 minutes and says I need to contact Cloudflare for an increase. What does it look like for you? Do you get charged for unused storage?

Yeah they charge for unused storage, as far as I know. I don’t mind that so much as long as I can make incremental increases, but that seems to be a blocker. And if my service grows as a rapid rate, I would be need to pay for A LOT of storage that could, theoretically, not be used. Alternatively, I’ll end up going into the dashboard and upgrading storage every other week which is a manual task that nobody wants to do.

Im kind of stuck at this point.

It’s a little late now, so you probably won’t get much of an official answer until after the weekend.

This might be something you’d have to contact Sales for, via email or a phone call.

We’re having the exact same problem. Did you manage to come up with a solution for this?

After a couple calls with CloudFlare we had two options:

  1. Buy a lot more space than we need and keep an eye on how much space we use (the daily emails are helpful). This is the option we took. Or,
  2. Subscribe to CloudFlare’s Enterprise plan, which gives you other benefits along with 50,000 minutes of buffer time in case you go over. We’ll be hopping on this soon enough, we’re just not quite at that level (it’s a bit more expensive but seems totally worth it)

We’ve recently used the API to loop through all of the videos we have uploaded and totalled up the minutes used - we’re then keeping track of this on an internal dashboard so we know when we need to add another 1,000 minutes. Not ideal, but works well for now.

If you buy more space than you need, do you still pay for the unused space?

I’ll take a look at that enterprise plan for future reference. We’re not at this level yet either but may be something for the future. I do hope Cloudflare enhance what is currently a pretty basic offering.

The API loop is a smart thing to do. We looked into that as well but I get a daily email saying “your capacity is low at 82%” with the total minutes remaining. So we just go off that, as a lazy solution.

Yeah we still pay for the unused space, unfortunately. We’ve been increasing by 50,000 minutes at a time so we don’t need to constantly add more - but it’s more expensive. It fills up fast enough for us that it’s not a major concern.

I also hope they enhance CloudFlare Stream!

For what it’s worth, there is a undocumented (so can change without notification) API here:

https://api.cloudflare.com/client/v4/accounts/{ACCOUNTID}/stream/storage-usage

which will return a result like this:

{
    "errors": [],
    "messages": [],
    "result": {
        "lastSevenDayUploadBytes": 0,
        "totalStorageMinutes": 2223.29,
        "totalStorageMinutesLimit": 10000,
        "videoCount": 130
    },
    "success": true
}

This is the API dashboard uses to show the % of capacity remaining. Might be better than @weboptic’s solution to loop through all videos.

I will work to get this documented soon so it’s easier to keep track of this.

2 Likes

This works quite well.

Python implementation:

url = f'https://api.cloudflare.com/client/v4/accounts/{settings.CLOUDFLARE_ACCOUNT_ID}/stream/storage-usage'
payload = {
    "X-Auth-Email": settings.CLOUDFLARE_API_EMAIL,
    "X-Auth-Key": settings.CLOUDFLARE_API_KEY,
    "Content-Type": "application/json",
}
res = requests.get(url, headers=payload)
print(res.json())