1

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

4 Answers 4

2

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

2

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.

0

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.

3
  • but i cant stop it either, i can just reboot or terminate it. Dec 16, 2011 at 0:13
  • 1
    Oh, it's an ephemeral instance (non ebs-backed). Unfortunately, this is the HUGE disadvantage one runs using a non-ebs/ephemeral instance type in EC2, you can't do snapshots/AMI creation. Painful lesson =[ If you reboot it, your data/settings will all be reset.
    – thinice
    Dec 16, 2011 at 0:14
  • What filesystem is your instance on? It's possible to mount an EBS image, freeze the filesystem and dd the data; but you won't be able to have it serve in a bare metal recovery
    – thinice
    Dec 16, 2011 at 0:16
0

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/

You must log in to answer this question.

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