I have noticed our site’s S3 image service bandwidth (transfer) costs keep going up and up. The pricing is $.09/GB and that can add up pretty fast.. I assume I am not the only site with this issue? I am paying Amazon $70/month for transfer alone now, that’s more than my VM costs. The S3 storage cost is only $5/month, the whole problem is transfer charges.
I don’t have any CDN or caching set up, just a totally generic Discourse running on a Linode VM using the S3 image buckets. What are bigger sites with lots of images doing? CDN (I assume that will cut costs)? Using Digital Ocean Spaces or Minio? Something else I am missing??
Hmm.. looking at the bandwidth costs on Fastly and the Amazon CloudFront (and others) they are pretty much the same as the .09/GB I am paying now
Cloudflare seems to not charge for bandwidth?? Maybe that is the thing to try then. Is there a post on how to hook up Cloudflare for S3 images CDN on Discourse? I see the s3_cdn_url but can’t find instructions on how to use it (other than I need to rebake once I set it up). Looking at Cloudflare it seems like you need to have your own domain since the DNS needs to be changed.. so I would have to make a CNAME something like s3-cloudflare.mydomain.com which would point to my S3 bucket IP, and tell Cloudflare to do it’s thing on that URL, and also set s3_cdn_url to that, and then rebake?
Here is a support page I found at Cloudflare which seems to indicate this might work:
I’m using Cloudflare on my Discourse site and it works fine. You basically route all your traffic through Cloudflare and tell it what to process or cache and that’s it. There are a few things to keep in mind though:
Configure Cloudflare to NOT cache anything (set up exceptions using page rules, see below).
Don’t let Cloudflare touch your Javascript - specifically, turn off Rocket Loader.
I’m not sure about Brotli compression yet, I disabled it.
Set up page rules to cache the avatar and upload directories as below (ignore rule #1, it’s site specific).
Cloudflare is currently caching a little over 3TB of data per month for me and it’s serving large graphics pretty fast.
If you’re more interested in a CDN I can also recommend https://www.belugacdn.com/ (I’m not affiliated with them). I use them on a large WordPress platform and performance is good, at a fraction of the cost of some other CDN platforms I looked at (those might be even more performant, but Beluga meets my needs).
저도 같은 상황입니다. 얼마 전 CloudFront으로 전환했는데, 비용도 비슷하게 나오고 있습니다. 로컬 캐싱 덕분에 비용 절감이 있을 줄 알았거든요. 즉, 같은 지역에서 동일한 이미지가 반복적으로 로드되면 대역폭 사용량이 줄어들 것이라고 생각했지만, 지금까지는 그런 것 같지 않습니다.
CloudFront 대신 사용할 수 있는 다른 CDN이 있을 것 같은데, Discourse는 이미지 URL을 다시 작성하는 것 외에는 거의 범용적인 방식으로 동작하는 것 같습니다(그렇게 보이지만요). 아마 이미지 전용으로 Cloudflare을 사용할 수 있을지도 모릅니다.
이 스레드가 다시 활성화되었으니 후속 내용을 덧붙여야 할 것 같습니다. Amazon CloudFront의 가격이 상당히 인하된 것 같습니다. 어떤 조치를 취했는지는 모르겠지만, 월 평균 AWS 비용이 약 80달러에서 15달러로 줄었습니다. 이는 이미지 전용으로 S3와 CloudFront를 사용하는, 이미지가 매우 많은 사이트의 경우입니다.
몇 년 전에는 Cloudflare가 Discourse와 잘 작동하지 않았을 수 있지만, 지금은 그렇지 않습니다. 이 부분에 대한 의심이 계속 반복되지 않는 것이 좋겠습니다. 구체적인 문제가 있는 경우, 여기에서 지원 스레드를 시작하여 작동하지 않는 부분을 설명해 주시기 바랍니다.