首页 > 解决方案 > 在 AWS 中选择数据存储类型

问题描述

如果不应对现有的本地应用程序进行代码更改,您会为数据存储选择什么,S3 或 EBS?

标签: amazon-web-services

解决方案


来自亚马逊提供的文档。亚马逊s3:

Amazon S3 has a simple web services interface that you can use to store 
and retrieve any amount of data, at any time, from anywhere on the web.
It gives any developer access to the same highly scalable, reliable, 
fast, inexpensive data storage infrastructure that Amazon uses to run 
its own global network of web sites. The service aims to maximize 
benefits of scale and to pass those benefits on to developers. 

亚马逊 EBS:

Amazon Elastic Block Store (Amazon EBS) provides persistent block 
storage volumes for use with Amazon EC2 instances in the AWS Cloud. 
Each Amazon EBS volume is automatically replicated within its 
Availability Zone to protect you from component failure, offering high 
availability and durability. Amazon EBS volumes offer the consistent 
and low-latency performance needed to run your workloads. With Amazon 
EBS, you can scale your usage up or down within minutes – all while 
paying a low price for only what you provision.

其文档清楚地表明,EBS 只能由 EC2 实例使用。例如,我在我的 EC2 实例上与我的应用程序一起托管了一个数据库,这种情况下的风险是,如果我的服务器出现故障,我的所有数据都将随之丢失。我不会使用 Amazon 的托管数据库,如 RDS、Dynamo、CloudDB(成本可能是一个因素)或具有复制功能的数据库(多个实例的成本可能是一个因素),我将在我的 EC2 实例中附加一个 EBS,我将将此 EBS 挂载为目录,并将此目录作为我的数据库的数据文件夹。

如果我的 EC2 实例发生故障,我将分离此 EBS 并附加到不同的服务器,我的所有数据将再次可用。

注意:您还可以定期为您的 EBS 拍摄快照以作为安全措施。

另一方面,s3 就像一个平面文件系统,其工作方式类似于 CDN。Amazon S3 的基本存储单元是组织成桶的对象。每个对象都由用户分配的唯一键标识。

Amazon S3 是一种对象存储,能够存储高达 5TB 的超大对象。S3 通常用于存储图像、视频、日志和其他类型的文件。S3 存储桶中可以存储的对象数量没有限制。S3 中的每个对象都有一个 url,可用于下载该对象。S3 中的对象也可以通过 Amazon Cloudfront CDN(内容交付网络)交付。S3 中的对象可以存档到 Amazon Glacier,这是一项非常便宜的存档服务。


推荐阅读