Are All EC2 Instance Level Storage Lost Upon Rebooting the Instance?

0

Apologies for the noob question. Some readings led me to believe that an instance level EC2 storage will be lost if I reboot. So the questions I have are

  • If the storage is totally lost, how does a computer even remember anything? Should not it remember at least the username, password, sudo group etc. across reboots?
  • How to store my codes, configurations in an EC2 instance to be retained across reboots? Is it possible at all, or does it have to be something like an EBS that is decoupled from the instance and must be mounted on every start up?

I am intending to use Ubuntu 22.04 as the OS, if that is important.

della
demandé il y a un an2568 vues
1 réponse
2

Some Amazon Elastic Compute Cloud (Amazon EC2) instance types come with a form of directly attached, block-device storage known as the instance store. The instance store is ideal for temporary storage, because the data stored in instance store volumes is not persistent through instance stops, terminations, or hardware failures.

For data you want to retain longer, or if you want to encrypt the data, use Amazon Elastic Block Store (Amazon EBS) volumes instead. EBS volumes preserve their data through instance stops and terminations, can be easily backed up with EBS snapshots, can be removed from one instance and reattached to another, and support full-volume encryption. To prevent unintentional changes or data loss, it's a best practice to perform regular snapshots, which can be automated with AWS Backup.

You can specify instance store volumes for an instance only when you launch it. You can't detach an instance store volume from one instance and attach it to a different instance.

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:

  1. The underlying disk drive fails
  2. The instance stops
  3. The instance hibernates
  4. The instance terminates

Therefore, do not rely on instance store for valuable, long-term data. Instead, use more durable data storage, such as Amazon S3, Amazon EBS, or Amazon EFS.

When you stop an instance, the data on any instance store volumes is erased. Before you stop an instance, verify that you've copied any data that you need from your instance store volumes to persistent storage, such as Amazon EBS or Amazon S3.

You can test reboots if you would like to verify.

Reference

  1. https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/InstanceStorage.html
  2. https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/Stop_Start.html
  3. https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-instance-reboot.html
profile pictureAWS
EXPERT
répondu il y a un an
  • Thanks a lot for the helpful references. Am just curious, as you say the instance storage is erased at each stopping, where does the instance store even basic login details? Does not even the boot process need a hard drive to load the OS from?

  • It's in the Amazon Machine Image (AMI), augmented with CloudInit

Vous n'êtes pas connecté. Se connecter pour publier une réponse.

Une bonne réponse répond clairement à la question, contient des commentaires constructifs et encourage le développement professionnel de la personne qui pose la question.

Instructions pour répondre aux questions