简体   繁体   English

什么数据存储在 Amazon EC2 实例的临时存储中?

[英]What data is stored in Ephemeral Storage of Amazon EC2 instance?

I am trying to stop a Amazon EC2 instance and get the warning message我正在尝试停止 Amazon EC2 实例并收到警告消息

Warning: Please note that any data on the ephemeral storage of your instance will be lost when it is stopped.警告:请注意,实例的临时存储上的所有数据在停止时都将丢失。

My Question我的问题

What data is stored in ephemeral storage of an Amazon EC2 instance?哪些数据存储在 Amazon EC2 实例的临时存储中?

Basically, root volume (your entire virtual system disk) is ephemeral, but only if you choose to create AMI backed by Amazon EC2 instance store .基本上,根卷(您的整个虚拟系统磁盘)是短暂的,但前提是您选择创建由Amazon EC2 实例存储支持的 AMI。

If you choose to create AMI backed by EBS then your root volume is backed by EBS and everything you have on your root volume will be saved between reboots.如果您选择创建由 EBS 支持的AMI,那么您的根卷由 EBS 支持,并且您在根卷上的所有内容都将在重新启动之间保存

If you are not sure what type of volume you have, look under EC2->Elastic Block Store->Volumes in your AWS console and if your AMI root volume is listed there then you are safe.如果您不确定您拥有什么类型的卷,请查看 AWS 控制台中的 EC2->Elastic Block Store->Volumes,如果您的 AMI 根卷在此处列出,那么您是安全的。 Also, if you go to EC2->Instances and then look under column "Root device type" of your instance and if it says "ebs", then you don't have to worry about data on your root device.此外,如果您转到 EC2->Instances,然后在您的实例的“根设备类型”列下查看,如果它显示“ebs”,那么您不必担心根设备上的数据。

More details here: http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/RootDeviceStorage.html更多详细信息:http: //docs.aws.amazon.com/AWSEC2/latest/UserGuide/RootDeviceStorage.html

Anything that is not stored on an EBS volume that is mounted to the instance will be lost.未存储在挂载到实例的 EBS 卷上的任何内容都将丢失。

For example, if you mount your EBS volume at /mystuff , then anything not in /mystuff will be lost.例如,如果您将 EBS 卷挂载到/mystuff ,那么/mystuff mystuff 中没有的任何内容都将丢失。 If you don't mount an ebs volume and save stuff on it, then I believe everything will be lost.如果您不安装 ebs 卷并在其上保存内容,那么我相信一切都会丢失。

You can create an AMI from your current machine state, which will contain everything in your ephemeral storage.您可以从您当前的机器状态创建一个 AMI,它将包含您临时存储中的所有内容。 Then, when you launch a new instance based on that AMI it will contain everything as it is now.然后,当您启动基于该 AMI 的新实例时,它将包含现在的所有内容。

Update: to clarify based on comments by mattgmg1990 and glenn bech:更新:根据 mattgmg1990 和 glenn bech 的评论进行澄清:

Note that there is a difference between "stop" and "terminate".请注意,“停止”和“终止”是有区别的。 If you "stop" an instance that is backed by EBS then the information on the root volume will still be in the same state when you "start" the machine again.如果您“停止”由 EBS 支持的实例,那么当您再次“启动”机器时,根卷上的信息仍将处于相同状态。 According to the documentation, "By default, the root device volume and the other Amazon EBS volumes attached when you launch an Amazon EBS-backed instance are automatically deleted when the instance terminates" but you can modify that via configuration.根据文档,“默认情况下,启动 Amazon EBS 支持的实例时附加的根设备卷和其他 Amazon EBS 卷会在实例终止时自动删除”,但您可以通过配置对其进行修改。

To be clear and answer @Dean's question: EBS-type root storage doesn't seem to be ephemeral.明确并回答@Dean 的问题:EBS 类型的根存储似乎不是短暂的。 Data is persistent across reboots and actually it doesn't make any sense to use ebs-backed root volume which is 'ephemeral'.数据在重新启动后是持久的,实际上使用 ebs 支持的“临时”根卷没有任何意义。 This wouldn't be different from image-based root volume.这与基于图像的根卷没有什么不同。

According to AWS documentation [ https://aws.amazon.com/premiumsupport/knowledge-center/instance-store-vs-ebs/] instance store volumes is not persistent through instance stops, terminations, or hardware failures.根据 AWS 文档 [ https://aws.amazon.com/premiumsupport/knowledge-center/instance-store-vs-ebs/] ,实例存储卷不会因实例停止、终止或硬件故障而持久存在。 Any AMI created from instance stored disk doesn't contain data present in instance store so all instances launched by this AMI will not have data stored in instance store.从实例存储磁盘创建的任何 AMI 都不包含实例存储中存在的数据,因此此 AMI 启动的所有实例都不会将数据存储在实例存储中。 Instance store can be used as cache for applications running on instance, for all persistent data you should use EBS.实例存储可以用作在实例上运行的应用程序的缓存,对于所有持久数据,您应该使用 EBS。

ephemeral is just another name of root volume when you launch Instance from AMI backed from Amazon EC2 instance store当您从由 Amazon EC2实例存储支持的 AMI 启动实例时,临时只是根卷的另一个名称

So Everything will be stored on ephemeral.所以一切都将存储在短暂的时间里。

if you have launched your instance from AMI backed by EBS volume then your instance does not have ephemeral.如果您从由 EBS 卷支持的 AMI 启动实例,则您的实例没有临时性。

For EC2 instance对于 EC2 实例

Stop & Start != Reboot

so for ephemeral storage (Instance Store) Stop cause data lost Reboot will not所以对于临时存储(Instance Store) Stop导致数据丢失Reboot不会

refer: https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/InstanceStorage.html#instance-store-volumes参考: https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/InstanceStorage.html#instance-store-volumes

The data in an instance store persists only during the lifetime of
 its associated instance. If an instance reboots (intentionally or
 unintentionally), data in the instance store persists. However, 
data in the instance store is lost under any of the following
 circumstances:

- The underlying disk drive fails

- The instance stops

- The instance hibernates

- The instance terminates

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

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