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've got the problem, that i need to clone a EC2 Instance but cant create an Image of my running Instance. Where is the Problem? I Hope somebody of you know the AWS and is able to help me out.

http://screencast.com/t/9l1wSb0Fjas

Greetings, Frederick

share|improve this question

4 Answers 4

up vote 1 down vote accepted

You will notice that the greyed out option in your picture is for EBS backed instances, while your instance has an instance-store (i.e. S3-backed) root volume.

In order to clone this instance, you have two options.

Option 1: If you wish for your (new) instance to also be instance-store, you can create an AMI of the existing instance and launch a new instance from that. It will be identical to your current instance (but only the root volume - if you have data on the other ephemeral disks, you will need to deal with that separately). For this approach:

ec2-bundle-vol -d /mnt -k $EC2_PRIVATE_KEY -c $EC2_CERT -u USERID -s SIZE

ec2-upload-bundle -b BUCKETNAME -m MANIFESTFILE -a ACCESSKEY -s SECRETKEY

(If you are running something such as bind, you will want to stop it before bundling - in fact, it is best to stop whatever services you can in order to get a consistent image - depending on the utilization of your server, you may also consider freezing the filesystem)

Option 2: Copy the root filesystem to an EBS volume, and then create an AMI from that.

Attach an EBS volume that will hold the data of your root volume Mount your EBS volume, and copy the data using:

rsync -aHAXxSP /source /target

Launch an instance based on your new EBS volume (you will need to explicitly specify any ephemeral storage (i.e. block mappings) you want your instance to include at launch time or when you create the AMI).

share|improve this answer

You can't make an image of it, because you can't do a full disk clone of a live filesystem - otherwise you would be trying to copy files that are in mid-manipulation resulting in corruption.

That option will become available if the instance was stopped.

share|improve this answer

I wrote an article describing how to create an AMI from a running instance-store instance:

Creating a New Image for EC2 by Rebundling a Running Instance
http://alestic.com/2009/06/ec2-ami-bundle

This was back in 2009 before EBS boot instances were available.

You do run a small risk of ending up with an inconsistent file system, but it's rare.

I recommend you switch to EBS boot instances where it is much easier to create AMIs along with a host of other great benefits.

share|improve this answer

This is an old, but very good and in-depth answer on how to do exactly what you're looking for.

http://robrohan.com/2009/01/30/saving-a-customised-linux-amazon-instance-ec2-and-s3/

share|improve this answer

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.
{"cc_re__cc_re__cc_by_sa_3_0": ["sites in the Stack Exchange network\">Area 51</a></li>\r\n                        <li><a href=\"//careers.stackoverflow.com?utm_source=stackoverflow.com&amp;utm_medium=site-ui&amp;utm_campaign=footerlink\">Stack Overflow Careers</a></li>\r\n                    \r\n                </ol>\r\n            </td>\r\n    </tr>\r\n</table>\r\n                </div>\r\n            </div>\r\n\r\n            <div id=\"copyright\">\r\n                site design / logo &#169; 2014 stack exchange inc; user contributions licensed under <a href=\"http://creativecommons.org/licenses/by-sa/3.0/\" rel=\"license\">cc by-sa 3.0</a>                   with <a href=\"http://blog.stackoverflow.com/2009/06/attribution-required/\" rel=\"license\">attribution required</a>\r\n            </div>\r\n            <div id=\"svnrev\">\r\n                rev 2014.11.25.2047\r\n            </div>\r\n            \r\n        </div>\r\n    </div>\r\n    <noscript>\r\n        <div id=\"noscript-warning\">Server Fault works best with JavaScript enabled<img src=\"http://pixel.quantserve.com/pixel/p-c1rF4kxgLUzNc.gif\" alt=\"\" class=\"dno\"></div>\r\n    </nosc"], "copyright__copyright__copyright": ["uch easier to create AMIs along with a host of other great benefits.\n\nshare|improve this answer\n\nThis is an old, but very good and in-depth answer on how to do exactly what you're looking for.\n\nhttp://robrohan.com/2009/01/30/saving-a-customised-linux-amazon-instance-ec2-and-s3/\n\nshare|improve this answer\n\nYour Answer\n\n\u00a0\ndiscard\n\nBy posting your answer, you agree to the privacy policy and terms of service.\n\nNot the answer you're looking for? Browse other questions tagged or ask your own question."]}