Amazon EC2 - Convert EBS root device with instance store root device
Asked Answered
S

2

13

I see that you can convert an instance stored instance to be EBS backed as this question shows. However, I want to do the opposite, take an EBS backed instance and convert it to be Instance Store backed.

Is this possible? How do I do this?

Slickenside answered 21/4, 2011 at 14:59 Comment(0)
O
9
  1. Launch an instance-store instance from an AMI that uses the same kernel used by your EBS-backed AMI.

  2. Create an EBS volume from the snapshot underlying the EBS AMI. (Alternatively, launch an instance of the EBS AMI and Stop the instance when it begins booting. Detach the root volume from the instance - this is usually the volume attached to /dev/sda1.)

  3. Attach the EBS volume to the instance-store instance.

  4. rsync the contents of the EBS volume to the root volume.

  5. Create an instance-store AMI using the standard methods.

  6. Detach the EBS volume and delete it. If you launched an EBS instance in step 2, terminate it.

Overleap answered 3/5, 2011 at 16:43 Comment(1)
Note that this is for Linux VMs only (Windows doesn't have rsync).Expensive
B
8

You can try this:

# Install ec2-tools (http://s3.amazonaws.com/ec2-downloads/ec2-api-tools.zip)

$ export EC2_PRIVATE_KEY=/path/to/your/key.pem
$ export EC2_CERT=/path/to/your/sert.pem
$ export AWS_ACCOUNT_ID=XXXX-XXXX-XXXX
$ export AWS_KEY=YOURAWSKEY
$ export AWS_SECRET_KEY=YOURAWSSECRETKEY

$ ec2-bundle-vol -d /tmp -k $EC2_PRIVATE_KEY -c $EC2_CERT -u $AWS_ACCOUNT_ID
$ ec2-upload-bundle -b s3-bucket-name -m /tmp/image.manifest.xml -a $AWS_KEY -s $AWS_SECRET_KEY
$ ec2-register s3-bucket-name/image.manifest.xml -K $EC2_PRIVATE_KEY -C $EC2_CERT --region eu-west-1
# In command above you can choose another region (e.g us-west-1)
# By running command above you will see on your screen something like this: IMAGE   ami-3cc1a4a
# Now you can create new instance based on your just registered ami-3cc1a4a using ec2-tools or Amazon Console

Good luck!

Byington answered 12/8, 2011 at 8:24 Comment(2)
This is also a Linux only solutionSolly
Could you please clarify why the private key is needed? My understanding is that this is stored by AWS and you can't specify the path. ThanksDelayedaction

© 2022 - 2024 — McMap. All rights reserved.