How to keep the Amazon EBS Backed AMI persistent

amazon ec2amazon-web-services

I was happy to hear about EBS Backed AMI, but I am confused. It doesn't seems persistent at all.

I created EC2 instance using one of Amazon's Linux EBS Backed AMI. I updated and added http server and python. I noticed the EBS AMI has been added to the EBS Volume. Then I terminated the EC2 instance to continue my work some other time, once I terminated, everything was gone. The EBS Volume and all the changes that I made. Confused why EBS volume is gone? How this is persistent?

Then I did the same thing again above. This time I created and registered the AMI before shutting it down. But every update after creating new AMI is lost.

Everytime I update a file or other configuration, I don't want to register and create a new AMI. That seems tedious and inefficient. Why do they call this EBS if everything is lost after terminating the instance? Am I doing something wrong? Is it possible to create a persistent AMI without need to register new image every time you update a file?

Best Answer

By default, EC2 instance "terminate" automatically deletes all EBS volumes that were automatically created with the instance, but this can be changed. It does not,by default, delete EBS volumes that were attached after the instance started running, and this also can be changed.

Here's an article I wrote on how to protect your important data with EBS boot instances:

Three Ways to Protect EC2 Instances from Accidental Termination and Loss of Data
http://alestic.com/2010/01/ec2-instance-locking

Note: Instance failure should not automatically delete your EBS volume. However, EBS volume failure is itself one failure mode, so make sure you are creating regular EBS snapshots. Not only does this give you a backup to rely on, but it also magically and transparently increases the reliability of the EBS volume itself.