简体   繁体   English

Heroku + Paperclip + Amazon S3 - 定价?

[英]Heroku + Paperclip + Amazon S3 - Pricing?

Since Heroku is a read-only filesystem I can't use paperclip to store a small quantity of files on the server. 由于Heroku是一个只读文件系统,我不能使用paperclip在服务器上存储少量文件。 Database image storage is an option, but not particularly ideal since that may crank my client's DB size up from a few hundred KB to over the 5 MB 'free' shared DB limit (depending on size of images). 数据库映像存储是一个选项,但不是特别理想,因为这可能会使我的客户端的数据库大小从几百KB增加到超过5 MB的“免费”共享数据库限制(取决于映像的大小)。

That leaves Amazon S3 as a likely solution. 这使得Amazon S3成为可能的解决方案。 I understand that Heroku is hosted on EC2 (I believe?). 我知道Heroku是在EC2上托管的(我相信?)。 Amazon's pricing wording was a little bit confusing when referring to S3-EC2 file transfers. 在提到S3-EC2文件传输时,亚马逊的定价措辞有点令人困惑。 If I have my client setup an S3 account and let them do file transfers to and from there, what is the pricing going to look like? 如果我让我的客户端设置了一个S3帐户并让他们进行文件传输,那么定价会是什么样的?

Is it cheaper from an S3 point-of-view to to both upload and download data in the rails controllers, and then feed the data to the browser using send_file? 从S3的角度来看,在rails控制器中上传和下载数据是否更便宜,然后使用send_file将数据提供给浏览器? Or would it make more sense to just link straight to the image or pdf from the browser like normal? 或者直接链接到浏览器中的图像或pdf更正常吗?

Would my client have to pay anything at all since heroku is hosted on Amazon? 因为heroku在亚马逊上托管,我的客户是否必须支付任何费用? I was looking for other questions related to this but there weren't any really straight answers concerning which parts of the file transfer would be charged for. 我正在寻找与此相关的其他问题,但没有任何关于文件传输的哪些部分将被收取的真正直接答案。

I guess the storage would cost a little (hardly anything), but what about the bandwidth? 我想存储会花费一点(几乎没有),但带宽怎么样? Thanks :) 谢谢 :)

Is it cheaper from an S3 point-of-view to to both upload and download data in the rails controllers, and then feed the data to the browser using send_file? 从S3的角度来看,在rails控制器中上传和下载数据是否更便宜,然后使用send_file将数据提供给浏览器? Or would it make more sense to just link straight to the image or pdf from the browser like normal? 或者直接链接到浏览器中的图像或pdf更正常吗?

From an S3 standpoint, yes, this would be free, because Heroku would be covering your transfer costs. 从S3的角度来看,是的,这是免费的,因为Heroku将承担您的转账费用。 HOWEVER: Heroku only lets a script run for 30 seconds, and during that time, other clients wont be able to load the site, so this is really a terrible idea. 但是:Heroku只允许脚本运行30秒,在此期间,其他客户端将无法加载该站点,所以这真是一个糟糕的主意。 Your best bet is to serve the files out of S3 directly, in which case, yes your customer would be transfer between S3 and the end user. 您最好的选择是直接从S3提供文件,在这种情况下,是的,您的客户将在S3和最终用户之间进行转移。

Any interaction you have with the file from Heroku (ie metadata and what not) will be free because it is EC2->S3. 您与Heroku中的文件进行的任何交互(即元数据和非元数据)将是免费的,因为它是EC2-> S3。

For most cases, your pricing would be identical to what it would be if you were not using heroku. 对于大多数情况,您的定价将与您不使用heroku时的定价相同。 The only case where this would change would be if your app is constantly accessing the data directly on S3 (to read metadata/load files) 如果您的应用程序不断直接在S3上访问数据(读取元数据/加载文件),那么这种情况会发生变化的唯一情况

You can use Paperclip on Heroku - just not the local file system for storage. 您可以在Heroku上使用Paperclip - 而不是本地文件系统进行存储。 Fortunately Paperclip can use s3 for storage. 幸运的是,Paperclip可以使用s3进行存储。 Heroku has a tech article here that covers it. Heroku 在这里有一篇技术文章,涵盖了它。

Also when an asset that's been uploaded is displayed on a page (lookup asset_host ) the image would be loaded directly from your s3 buckets URL so you will pay Amazon for a get request to the image and then for data transfer involved but also for storing the assets on s3. 此外,当上传的资产显示在页面上(查找asset_host )时,图像将直接从您的s3存储桶URL加载,因此您将向Amazon支付对图像的获取请求,然后进行数据传输但也用于存储s3上的资产。 Have you looked at the s3 calculator to get indicative costs? 您是否看过s3计算器以获得指示性成本?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM