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?
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.
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.
- 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)
- 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.
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