ChatGPT解决这个技术问题 Extra ChatGPT

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

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?


a
atilacamurca

Basically, root volume (your entire virtual system disk) is ephemeral, but only if you choose to create AMI backed by Amazon EC2 instance store.

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.

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. 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.

More details here: http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/RootDeviceStorage.html


This probably wouldn't confuse people so much, if AWS wasn't giving the unnecessary warning message "that any data on the ephemeral storage of your instance will be lost" even when attempting to stop an instance, that IS using an EBS backed root device, and there is actually no reason to worry about any data loss.
the warning applies because you can have both an BS backed root AND an ephemeral storage attached (manually as aws doesnt do so by default)
Actually, I just went ahead and did this but there was an error anyway: Unable to connect to your database server using the provided settings. Filename: core/Loader.php Line Number: 346 Any ideas? This wasn't happening prior to doing this.
Just to follow up, for some reason mysqld service stopped running. Support said this is not normal, but that was the only issue.
@Tilman Exactly what I was thinking. The warning is not only unnecessary, it is misleading as well. Thanks for pointing it out.
J
Jude Niroshan

Anything that is not stored on an EBS volume that is mounted to the instance will be lost.

For example, if you mount your EBS volume at /mystuff, then anything not in /mystuff will be lost. If you don't mount an ebs volume and save stuff on it, then I believe everything will be lost.

You can create an AMI from your current machine state, which will contain everything in your ephemeral storage. Then, when you launch a new instance based on that AMI it will contain everything as it is now.

Update: to clarify based on comments by mattgmg1990 and 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. 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.


everything on the instance would be in ephermeral storage unless you have configured and mounted an ebs volume and are consciously putting your data on it.
Does this only apply to instance store devices? That is, on an ebs device, is my root storage drive ephemeral or not?
This answer is not exactly correct, where your data is stored depends on what type of AMI you chose to create. The below answer by @nidalpres is more complete. If you chose to create an AMI backed by EBS, then your root directory is NOT stored in ephemeral storage.
I would just like to add that I think that @nidalpres wrote a better answer, or at the very least one that is a lot easier to grasp.
"If you "terminate" the machine, then even if it is backed by EBS it is gone." This is not correct. This is determined by the flag "Delete on Termination" on the "add storage" page (referring to the root volume). It can also be specified on the command line, and even changed on running instances using the CLI (docs.aws.amazon.com/AWSEC2/latest/UserGuide/…)
j
januszm

To be clear and answer @Dean's question: EBS-type root storage doesn't seem to be ephemeral. Data is persistent across reboots and actually it doesn't make any sense to use ebs-backed root volume which is 'ephemeral'. This wouldn't be different from image-based root volume.


All EBS-backed storage is persistent, eg non-ephemeral, after you "Stop" the instance. If you "Terminate" you will lose the data. Please see stackoverflow.com/a/11566285/46249.
L
Lokesh Ranadive

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.


R
Ravindra Bagale

ephemeral is just another name of root volume when you launch Instance from AMI backed from Amazon EC2 instance store

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.


b
bo bac

For EC2 instance

Stop & Start != Reboot

so for ephemeral storage (Instance Store) Stop cause data lost Reboot will not