How can i create AMI from instance-store based EC2 instance?
I have an EC2 instance whose root device is 'instance-store'. While trying to create AMI for same, i could not see any option in instances tab or under volumes tab. I want to stop this instance & preserve AMI for future use to launch instance from same AMI.
The AWS console only provides access to functions that can work without access to your instance's file system. Instance-store AMIs actually have the files bundled, compressed, and encrypted - and therefore need file system access. To create such an AMI, you need to use the command line, from within an instance. (Note the difference between this and an EBS backed instance - with the latter, a snapshot can be generated of the block device, irrespective of the contents of that device.
The process of creating an instance-store AMI is well documented by AWS. Essentially:
-
ec2-bundle-vol
to create the AMIec2-bundle-vol -d /mnt -k $EC2_PRIVATE_KEY -c $EC2_CERT -u USERID -s SIZE
-
ec2-upload-bundle
to save it to S3ec2-upload-bundle -b BUCKETNAME -m MANIFESTFILE -a ACCESSKEY -s SECRETKEY
-
ec2-register
to register the AMI (this last one can be done from the AWS console).
Depending on your specific scenario, you may also be able to copy the contents of your instance-store volume to an EBS volume and convert your instance to an EBS backed instance (which would be a better approach). See this question for some additional points.