307

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?

7 Answers 7

276
Answer recommended by AWS Collective

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

8
  • 104
    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.
    – Tilman
    Mar 14, 2014 at 19:36
  • 2
    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)
    – Zig Mandel
    Jun 5, 2014 at 22:18
  • Just to follow up, for some reason mysqld service stopped running. Support said this is not normal, but that was the only issue.
    – James
    Sep 11, 2014 at 2:25
  • 4
    @Tilman Exactly what I was thinking. The warning is not only unnecessary, it is misleading as well. Thanks for pointing it out.
    – Sabuncu
    Dec 13, 2014 at 15:04
  • 1
    Keep in mind that NVMe SSD volumes are going to be lost when the instance is stopped: docs.aws.amazon.com/AWSEC2/latest/UserGuide/… The data on NVMe instance storage is encrypted using an XTS-AES-256 block cipher implemented in a hardware module on the instance. The encryption keys are generated using the hardware module and are unique to each NVMe instance storage device. All encryption keys are destroyed when the instance is stopped or terminated and cannot be recovered. You cannot disable this encryption and you cannot provide your own encryption key. Nov 19, 2018 at 15:35
154

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.

13
  • 1
    Can you help me with how can I see the content of ephemeral storage at any point in time? Jul 19, 2012 at 17:49
  • 2
    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. Jul 19, 2012 at 17:53
  • 2
    Does this only apply to instance store devices? That is, on an ebs device, is my root storage drive ephemeral or not?
    – Dean
    Oct 23, 2012 at 23:49
  • 20
    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. Oct 9, 2013 at 21:57
  • 1
    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.
    – Lozzano
    Oct 17, 2013 at 17:04
7

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.

1
  • 2
    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.
    – Matthew
    Jan 14, 2015 at 20:12
1

For EC2 instance

Stop & Start != Reboot

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

0

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.

0

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.

0

refer: 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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.