One day I was checking CloudFlare dashboard I noticed that one of the endpoints we were using to deliver new versions has huge bandwidth spikes.
Each new version we released was automatically downloaded by thousands of clients, resulting in terra bytes of egress costs to S3.
At the current rate this was around 3,000$/month.
Furthermore, our plan was to move to a daily release, which will make this problem even worse and jump to ~50,000$/month.
I immediately tried to think how to resolve this issue.
Since all the content we deliver on a new update is identical copies of the same new version, caching jumped into mind.
But unfortunately CloudFront costs weren't much better at around 2,500$/month.
Being a big fan of CloudFlare I knew of R2 and quickly calculated that using R2 will reduce the costs to effectively zero.
Implementing this was quite easy, simply store and serve from R2 instead of S3.
Another bonus was faster download speed.
Top comments (0)