Is Amazon Machine Image (AMI) immutable?
(Thanks in advance for putting up with my seemingly stupid question).
I mean: Consider a Windows 2003 VMWare image. If I 1 - run this image and then 2 - run the program that writes something to the file and then 3 - stop the VMWare image and then 4 - run the VMWare image. then this file is still on the hard disk of the VMWare image.
Is this the case for OMI? Or if my AMI stops, will I lose any changes?
thank
source to share
AMIs are immutable. Each time you launch an AMI instance on EC2, the local disk is in the exact state when you created (or "linked") the AMI.
However, you can attach persistent storage (EBS) to an instance, or push things to S3 (vai s3sync, etc.), or attach to a database (RDS) to have data that lives over the lifetime of the instance.
But none of them are enabled by default.
I believe it would be possible to write a script that was executed on boot and connected to the EBS volume (or pulled a previously generated file from S3, or connected to an RDS instance). If you put this on an image before linking, it will execute every time you run. Here is the recipe I found for creating and attaching an EBS volume on boot (I haven't tested it, caveat emptor).
Most likely, as close as possible to what VMWare provides with EC2.
source to share