Heroku +回形针 +亚马逊 S3 - 定价?
由于 Heroku 是只读文件系统,我无法使用回形针在服务器上存储少量文件。数据库图像存储是一种选择,但不是特别理想,因为这可能会将我客户的数据库大小从几百 KB 增加到超过 5 MB“免费”共享数据库限制(取决于图像的大小)。
这使得 Amazon S3 成为一种可能的解决方案。我了解 Heroku 托管在 EC2 上(我相信?)。在提到 S3-EC2 文件传输时,亚马逊的定价措辞有点令人困惑。如果我让我的客户设置一个 S3 帐户并让他们在该帐户之间进行文件传输,那么定价是多少?
从 S3 的角度来看,在 Rails 控制器中上传和下载数据,然后使用 send_file 将数据提供给浏览器是否更便宜?或者像平常一样从浏览器直接链接到图像或 pdf 会更有意义吗?
由于 Heroku 托管在 Amazon 上,我的客户是否需要支付任何费用?我一直在寻找与此相关的其他问题,但对于文件传输的哪些部分将收费,没有任何真正直接的答案。
我猜存储会花费一点(几乎没有什么),但是带宽呢?谢谢 :)
Since Heroku is a read-only filesystem I can't use paperclip to store a small quantity of files on the server. 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).
That leaves Amazon S3 as a likely solution. I understand that Heroku is hosted on EC2 (I believe?). Amazon's pricing wording was a little bit confusing when referring to S3-EC2 file transfers. 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?
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? Or would it make more sense to just link straight to the image or pdf from the browser like normal?
Would my client have to pay anything at all since heroku is hosted on Amazon? 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 :)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
从 S3 的角度来看,是的,这将是免费的,因为 Heroku 将承担您的传输费用。然而:Heroku 只让脚本运行 30 秒,在此期间,其他客户端将无法加载该站点,所以这确实是一个糟糕的主意。最好的选择是直接从 S3 提供文件,在这种情况下,是的,您的客户将在 S3 和最终用户之间转移。
您与 Heroku 中的文件进行的任何交互(即元数据等)都是免费的,因为它是 EC2->S3。
在大多数情况下,您的定价与不使用 heroku 时的定价相同。唯一会改变的情况是您的应用程序不断直接访问 S3 上的数据(以读取元数据/加载文件)
From an S3 standpoint, yes, this would be free, because Heroku would be covering your transfer costs. 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. 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.
Any interaction you have with the file from Heroku (i.e. metadata and what not) will be free because it is EC2->S3.
For most cases, your pricing would be identical to what it would be if you were not using 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)
您可以在 Heroku 上使用 Paperclip - 只是不能使用本地文件系统进行存储。幸运的是 Paperclip 可以使用 s3 进行存储。 Heroku 有一篇技术文章此处介绍了它。
此外,当已上传的资产显示在页面上(查找
asset_host
)时,图像将直接从您的 s3 存储桶 URL 加载,因此您需要向 Amazon 支付对图像的获取请求以及数据的费用涉及转移,但也用于将资产存储在 s3 上。您是否查看过 s3 计算器来获取指示性成本?You can use Paperclip on Heroku - just not the local file system for storage. Fortunately Paperclip can use s3 for storage. Heroku has a tech article here that covers it.
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. Have you looked at the s3 calculator to get indicative costs?