Search code examples
databaseamazon-ec2amazon-ami

amazon web services,(EC2) does DB and other files get stored when instance is rebooted?


I'm not familiar with their AMI(amazon machine image) concept.

I'll be using DB, and I wonder if DB contents(and any other data stored on file) are non-volatile.

I'm confused particularly because they talk about "loading AMI".
Anything that's written while EC2 is running will be written to AMI and will be there when AMI is loaded next time(reboot)?


Solution

  • If you use EBS backed instance for your database data, it will remain available after reboot but not after terminate. You can protect against terminate, though, we option at launch. In many cases you would not need to terminate your instance but only stop it, which is equivalent of shutdown. The only drawback will be that you continue to pay for the storage.

    I am going to check what happens if you reboot instance-store backed instance.


    Yes, for instance-store reboot will retain data. However, you will not have an option to stop instance. That is either it is running and you are paying for it or you don't have your data. I think it would be very bad idea to use instance storage for the database unless you know exactly what you are doing.

    As a general rule, I highly recommend using EBS storage.

    And as to AMI itself, think about it as a image of your harddrive. If you start image that you created month ago, it will only contain data from month ago.