Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to transfer an image to an Amazon EBS volume for EC2 usage?

I have a local filesystem image that I want to transfer to an Amazon EBS volume and boot as an EC2 micro instance. The instance should have the EBS volume as it's root filesystem - and I will be booting the instance with the Amazon PV-GRUB "kernels".

I have used ec2-bundle-image to create a bundle from the image, and I have used ec2-upload-bundle to upload the bundle to Amazon S3. However, now when I'd like to use ec2-register to register the image for usage, I can't seem to find a way to make the uploaded bundle be the ebs root image. It would seem that it requires an EBS snapshot to make the root device, and I have no idea how I would convert the bundle in to an EBS snapshot.

I do realize, that I could probably do this by starting a "common" instance, attaching an EBS volume to it and then just using 'scp' or something to transfer the image directly to the EBS volume - but is this really the only way? Also, I have no desire to use EBS snapshots as such, I'd rather have none - can I create a micro instance with just the EBS volume as root, without an EBS snapshot?

like image 449
Nakedible Avatar asked Sep 10 '10 07:09

Nakedible


People also ask

How do I connect EBS volume to EC2?

To attach an EBS volume to an instance using the consoleOpen the Amazon EC2 console at https://console.aws.amazon.com/ec2/ . In the navigation pane, choose Volumes. Select the volume to attach and choose Actions, Attach volume. You can attach only volumes that are in the Available state.

How do I add a volume snapshot to EC2 instance?

Select your EBS Volume and click on Attach Volume in the Actions. Select your required Linux EC2 Instance. Click on Attach. The EBS Volume has been attached to Second Linux EC2 Instance successfully.

How do you attach EBS snapshots?

Snapshot - Select the EBS Snapshot that you want to attach to the running server instance. Device name - Select the device name to which the created volume will be attached. Click the Override box to specify a different value. Attachment options - A volume will be created from the snapshot and attached to the instance.

Can we create EBS volume from snapshot?

You can create a volume from a snapshot using one of the following methods. Open the Amazon EC2 console at https://console.aws.amazon.com/ec2/ . In the navigation pane, choose Volumes. Choose Create volume.


1 Answers

Did not find any way to do this :(

So, I created a new instance, attached a newly created EBS volume to, attached it to the instance, and transferred the data via ssh.

Then, to be able to boot the volume, I still need to create a snapshot of it and then create an AMI that uses the snapshot - and as a result, I get another EBS volume that is created from the snapshot and is the running instance's root volume.

Now, if I want to minimize expences, I can remove the created snapshot, and the original EBS volume.

NOTE: If the only copy of the EBS volume is the root volume of an instance, it may be deleted when the instance is terminated. This setting can be changed with the command-line tools - or the instance may simple by "stopped" instead of "terminated", and then a snapshot can be generated from the EBS volume. After taking a snapshot, the instance can ofcourse be terminated.

like image 62
Nakedible Avatar answered Oct 01 '22 21:10

Nakedible