Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I have an EC2 instance running. I want to switch it off and preserve all its data and config so that I can revive it anytime I want with same set of data and config without any loss.

How can i do it?

Regards.

share|improve this question

migrated from stackoverflow.com Nov 7 '12 at 10:39

This question came from our site for professional and enthusiast programmers.

add comment

3 Answers

A few things to note here:

  • Use an AMI image that is EBS-backed. This means your root partition is on an Elastic Block Store, which gives you a lot of flexibility. Almost every recent public AMI image has this configured. This will allow you to 'Stop' an instance without 'Terminating' it. Do not use an instance-store AMI.

  • If you are concerned about data loss, take a snapshot of your volume. This can be done while the machine is running, but it is safer while it is stopped.

  • By default, EBS volumes are deleted when you terminate an instance, though this is configurable.

  • For good measure, enable termination protection. This prevents you from accidentally terminating your instance and only allows you to stop it. This setting can be changed at any time.

share|improve this answer
1  
I wrote an article that discusses EBS volume delete on terminate, termination protection, and shutdown behavior, along with commands to adjust these: alestic.com/2010/01/ec2-instance-locking –  Eric Hammond Nov 7 '12 at 2:57
add comment

I use EBS backed volumes for this reason. You can create an image AMI on the fly from an ebs backed instance. The create EBS image option is under the drop down menu where you start,stop,terminate... Keep in mind, you need to pick EBS compatible images when you first setup the server. Last time I checked, most of the public amazon instances in the classic setup are s3 backed. I created my own image from scratch so I could use EBS. Double check that. Amazon might have started offering EBS on their template images.

share|improve this answer
    
Thanks a lot. Now i could find 2 ways to do it for EBS backed instances: One is to select an instance in AWS console & under "Instance Action" menu, i can see 'Create Image(EBS AMI)'. Second is to create a snapshot from volume attached to an instance and then create image from snapshot. I was also successful in launching new instance from AMI i created using any of above steps.But i want to knwo how can i create AMI for an instance store backed instance not EBS backed? –  Lalit Nov 8 '12 at 5:45
add comment
up vote 0 down vote accepted

There are 2 ways to preserve EC2 instances for EBS backed stores: One is to select an instance in AWS console & under "Instance Action" menu, i can see 'Create Image(EBS AMI)'. Second is to create a snapshot from volume attached to an instance and then create image from snapshot.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.