我正在尝试停止Amazon EC2实例并获得警告消息

警告:请注意,实例的临时存储上的任何数据在停止时都将丢失。

我的问题

哪些数据存储在Amazon EC2实例的临时存储中?


没有存储在挂载到实例的EBS卷上的任何内容都将丢失。

例如,如果您在/mystuff上挂载EBS卷,那么不在/mystuff中的任何内容都将丢失。如果您不挂载ebs卷并在其上保存内容,那么我相信所有内容都将丢失。

您可以从当前的机器状态创建一个AMI,它将包含临时存储中的所有内容。然后,当您基于该AMI启动一个新实例时,它将像现在一样包含所有内容。

更新:根据mattgmg1990和glenn bech的评论澄清:

注意"stop"和"terminate"是有区别的。如果您“停止”一个由EBS支持的实例,那么当您再次“启动”计算机时,根卷上的信息仍将处于相同的状态。根据文档,“默认情况下,启动支持Amazon EBS的实例时附加的根设备卷和其他Amazon EBS卷将在实例终止时自动删除”,但您可以通过配置修改这一点。

要清楚地回答@Dean的问题:ebs类型的根存储似乎不是短暂的。数据在重启过程中是持久的,实际上使用ebs支持的根卷是“短暂的”,这没有任何意义。这与基于图像的根卷没有什么不同。

基本上,根卷(您的整个虚拟系统磁盘)是短暂的,但前提是您选择创建由Amazon EC2实例存储支持的AMI。

如果您选择创建由EBS支持的AMI,那么您的根卷将由EBS支持,并且您的根卷上的所有内容将在重新引导之间保存。

如果你不确定你有什么类型的卷,在AWS控制台中查看EC2->弹性块存储->卷,如果你的AMI根卷列在那里,那么你是安全的。同样,如果您转到EC2->Instances,然后在实例的“根设备类型”列下查看,如果它显示为“ebs”,那么您不必担心根设备上的数据。

更多详情请访问:http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/RootDeviceStorage.html

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. 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. Instance store can be used as cache for applications running on instance, for all persistent data you should use EBS.

ephemeral只是从Amazon EC2实例存储支持的AMI启动实例时根卷的另一个名称

所有东西都存储在ephemeral上。

如果您已经从AMI启动实例,由EBS卷支持,那么您的实例没有临时的。

对于EC2实例

Stop & Start != Reboot

对于临时存储(实例存储) 停止导致数据丢失 重启不会

参见: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