1

I have a server running on an AWS Micro instance. As it has EBS storage by default - there is no risk to lose data in case of termination. Can I skip AMI creation for micro instances?

3 Answers 3

1

You don't need to create an AMI unless you want to launch additional instances that are exactly like the one you are running, for example to launch a cluster of web servers serving the same content. In this situation, you could restore a server by creating a new instance, detaching the EBS volume that was created for it, and attaching the volume that you want to recover.

You are correct that the EBS storage means that the storage device will persist through termination of the instance.

3
  • But if I want to migrate my micro instance to small one. I have to create AMI to move my programs and make them persistent, right?
    – user349302
    Jul 2, 2011 at 1:05
  • Yes. If you want to resize the instance, the only supported way to do that is to stop the instance, create an AMI, and launch the AMI in the size you want to use.
    – BenGC
    Jul 2, 2011 at 1:09
  • 1
    The comment about resizing the instance requiring creating an AMI is incorrect. You can simply stop the instance, change the instance type and restart aws.typepad.com/aws/2011/03/… Jul 5, 2011 at 8:55
0

EBS storage does not persist by default when it is the root volume (i.e. EBS backed micro instances) - you must explicitly set it to be so. If you launch many AMIs, when they terminate, the root EBS volume will be deleted. (Set the DeleteOnTermination flag using ec2-modify-instance-attributes or use the AWS console)

EBS storage only persists by default if you manually create the EBS volume and then attach it to an instance.

As for migrating from a micro instance to a small instance, you do not need an AMI for that (although, you could use one). There are two common approaches.

  1. Either use ec2-modify-instance-attributes to change the instance type (you will need to stop the instance, run the command, and then start the instance)
  2. Or Stop (not terminate) the (micro) instance, detach the EBS volume, start a new (small), stop the new (small) instance, detach the existing EBS and attach your old EBS to the new (small) instance, start the small instance.
0

As pointed out earlier, by default EBS backed instances have their root EBS volume set to be deleted on termination. If you want to avoid that, you have to use:

ec2-modify-instance-attribute --region <region> device=vol-id:false <instanceid>

As an example, first check what's the status of the block devices of your instance:

$ ec2-describe-instance-attribute --region us-west-1 i-365ed96f -b
BLOCKDEVICE /dev/sda1   vol-0aa8ac24    2012-11-04T22:46:15.000Z    true        

The last column is "deleteOnTermination" and it's currently set to true (the default). You can change it to false with:

$ ec2-modify-instance-attribute --region us-west-1 -b /dev/sda1=vol-0aa8ac24:false i-365ed96f
BLOCKDEVICE /dev/sda1   vol-0aa8ac24        false       

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .