views:

169

answers:

3

(Thanks in advance for tolerating my seems-to-be-stupid question).

I mean: Consider a VMWare Windows 2003 image. If I 1 - start this image and then 2 - run a program that writes something to a file and then 3 - stop the VMWare image and then 4 - start the VMWare image then still that file resides on hard disk of the VMWare image.

Is that the case for an AMI? Or if my AMI stops, I will lost any changes?

Thanks

+1  A: 

If your instance stops, everything disappears thats not part of the initial image.

you need to bundle an instance into an image to save your changes.

as per this link

to store data you put it on a EBS.

Keith Nicholas
A: 

An instance is a copy of the image. You can start as many instances of the same image as you want. The image itself is immutable.

EC2 instances are transient. All data on the instance drives is lost when you shut it down.

You can store data permanently on EBS (or S3).

Alex Neth
+1  A: 

AMIs are immutable. Every time you start an instance of an AMI on EC2, the local disk is in the exact state it was when you created (or 'bundled') the AMI.

That said, you can attach persistent storage (EBS) to an instance, or ship things off to S3 (vai s3sync, etc) or attach to a database (RDS), in order to have data that lives past the instance lifetime.

But none of this is enabled by default.

I believe it would be possible to write a script that executed on boot and attached to an EBS volume, (or pulled a previously generated file from S3, or attached to an RDS instance). If you put that in the image before bundling, it would execute every time you started up. Here's a recipe I found for creating and attaching an EBS volume on boot (I didn't test it; caveat emptor).

That's probably as close as you can get to what VMWare provides with EC2.

mooreds