我应该在AWS S3上托管Web应用程序的静态内容 [英] Should I host the static content of my webapp on AWS S3

查看:203
本文介绍了我应该在AWS S3上托管Web应用程序的静态内容的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

对于将要在Amazon EC2实例上部署的具有中等数量静态媒体内容的Web应用程序,将静态内容包含在war文件中或将其托管在单独的S3实例上是否有意义?



在效果方面会有什么不同?
服务费用有何不同?
在复杂性方面有什么区别?

解决方案

绝对。出于4种以上的原因:




  • Amazon S3几乎无需管理,因此在配置,扩展等方面没有麻烦。

  • 您将减少EC2服务器负载

  • S3中的存储比EC2 EBS卷中的存储便宜,因为在S3中,您只为所消费的东西付费,在EC2中,您只需支付费用对于整个EBS预置存储(因此您需要支付一些可用空间)

  • 您最终可以添加一个CloudFront发行版,以使用户无论身在何处都可以访问静态内容(< a href = http://aws.amazon.com/cloudfront> http://aws.amazon.com/cloudfront )

  • 可能更多...



在成本方面:




  • 从S3到互联网的数据传输将与您在EC2上支付的价格相同

  • 您可能会降低存储成本

  • 您将拥有针对您的S3文件的请求数量所产生的额外费用( htt p://aws.amazon.com/s3/#pricing

  • 在高流量负载下,您可能还需要较少的EC2实例/资源(显然这不是事实上,因为它100%取决于您的应用)



发布新版本的应用程序,因为除了将其部署到EC2实例外,您还必须将新的静态文件版本上传到S3。但是您可以使用非常简单的脚本将其自动化。


For a web app with a moderate amount of static media content which will be deployed on an Amazon EC2 instance, does it make sense to include the static content inside the war file or to host it on a separate S3 instance.

What will be the differences in terms of performance? What will be the differences in terms of service costs? What will be the differences in terms of complexity?

解决方案

Absolutely. For 4+ reasons:

  • Amazon S3 is almost management-free, so no hassles on provisioning, scaling, etc.
  • You will reduce EC2 server load
  • The storage is cheaper in S3 than in EC2 EBS volumes, as in S3 you only pay for what you consume, in EC2 you pay for the whole EBS provisioned storage (so there is some free space which you are paying for)
  • You could eventually add a CloudFront distribution to approach the static content to your users wherever they are (http://aws.amazon.com/cloudfront)
  • probably more ...

In terms of costs:

  • the data transfer from S3 to internet would be the same as you would pay on EC2
  • you will probably reduce the cost of the storage
  • you will have an additional cost for the number of requests made to your S3 files (http://aws.amazon.com/s3/#pricing)
  • on high traffic loads, you will also probably need less EC2 instances / resources (this is obviously not a fact, as it depends 100% on your app)

You will also have an overhead of complexity when releasing a new version of the app, because besides deploying it into the EC2 instances, you will also have to upload the new static file versions to S3. But you could automate this with a pretty simple script.

这篇关于我应该在AWS S3上托管Web应用程序的静态内容的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆