Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to preserve data when stopping EC2 instance

I created a m3.large EC2 instance for data processing, I modified it to a 40GB root drive and it comes with a 3OGB additional drive. I only need to use it for a few days a month so the idea was to stop it when not in use and start it when required.

When I stopped it I was warned that

Emphermal storage data would be lost

on restarting this turned out to be a way of cryptically saying that everything on the 30Gb volume would be wiped which it has been, whereas the root volume that uses the 4OGB is untouched.

So why does it do this and if I hadn't increased the size of my root volume would all my changes on that be lost as well ?

like image 605
Paul Taylor Avatar asked Jul 03 '14 10:07

Paul Taylor


1 Answers

There 2 types of Volumes ( Disk ) provided by AWS

  1. EBS Volumes
  2. Ephemeral ( Instance Store )

EBS Volumes :

Your root volume is always EBS volume ( you can safely assume this point; almost all of the AMIs EBS based these days). The data in EBS volume would persist even if the instance is stopped or terminated; with this you can quickly remove the EBS volumes from one instance and reattached it to other.

Ephemeral ( Instance Store ) :

Ephemeral volumes are the temporary drives provided for the instance, the size ( 10 GB or 80 GB ), the count ( 2 disks or 5 disks ) the type ( Magnetic or SSD ) depends with each instance size.

The data in these drive would be wiped off during the event of instance stop and start. You may use this disk for non critical application activities like temporary file storage and processing, application log. If you need persistence of the content in this drive then you would need to move it to EBS based volumes or store it in S3 from time to time to prevent data loss.

There wont be any loss of data when you increase the size of the volume of an EBS Volume; you need take the snapshot of the volume and restore it again back to a volume of your required size ( increased size ). I have tried this couple of times; I haven't encountered any data loss during the process; but if you little concerned about this, you can upload the content to S3 for backup.

like image 178
Naveen Vijay Avatar answered Sep 25 '22 17:09

Naveen Vijay