mikelangelo-project / capstan

Capstan, a tool for packaging and running your application on OSv.
http://osv.io/capstan/
Other
19 stars 7 forks source link

Reg : AMI Manifest Path #43

Closed arc1986 closed 7 years ago

arc1986 commented 7 years ago

I have followed the steps and created with my own C application image. And i have converted it to a .raw image as well. Now i need to create a EC2 instance. I need to select a AMI Manifest Path before that. Could you please help me on this.

miha-plesko commented 7 years ago

Hello @acsdkquery ,

as far as I know it's not trivial to upload your own raw image to AWS and boot an EC2 instance out of it, but it's doable. Please see this StackOverflow answer. Basically you need to copy your raw image on EBS volume while it's attached to some auxilary instance and then you snapshot the volume and upgrade it to AMI image. Only then you're able to boot it.

While I've seen it done by a colleague of mine, I haven't done it myself yet because there is that UniK project that deploys OSv on AWS for you with ease. The Capstan tool is integrated there (well, it was half a year ago so the latest features may not be there yet, ping me if you will be missing something).

I hope I've answered to your question.

gberginc commented 7 years ago

Besides the UniK project mentioned by @miha-plesko, it is possible to create the AMI manually, but few steps are required for this. I used the script from the main OSv source that create and AMI for you. In order to do this, you have to launch a Linux instance in EC2 and download the above script. You may also need to install QEMU because the script uses it. Then scp your image onto this instance as well - I suggest you use QCOW2 image format (default by Capstan) as the script will use qemu-img to convert it. To launch the script, use

ec2-imake-ami.py --name=ami_name --input=/path/to/your/image

The way this works is it first creates an EBS volume of appropriate size, mounts it to this instance. Then converts your image into RAW format and copies it to this volume. Finally, it creates the snapshot of this volume and makes the AMI for you.

Keep in mind that the default size of the image, built with Capstan is 10 GB. Use --size to specify what you actually need.

arc1986 commented 7 years ago

Hi miha-plesko,

Thanks for your response. I followed the suggested steps.

EBS volume created on EC2 and mounted. copy raw image on EBS volume snapshot the volume and created a AMI and new EC2. But, while booting new EC2 , am getting the '1/2 checks passed' error.

So, After coping raw image to EBS, we have do any specific action. (b'ocz volume just having the .raw file and file system specific)

Kindly help on this issue.

arc1986 commented 7 years ago

Hi gberginc, Just got your input and thank you. I will try this and give you the updates.

arc1986 commented 7 years ago

Hi gberginc,

Followed the script and the AMI created successfully.

STEP 7: Took 0.125635147095 seconds to create ami ami ec2.Image(id='ami-20e7c35b') created

But, when i launch/start the EC2 with this, its automatically stopping. (not properly launching ) Kindly help on this.

miha-plesko commented 7 years ago

@acsdkquery what does System Log say (select instance, then Actions->Instance Settings->Get System Log)?

Did you manage to run your unikernel locally with Capstan before you did all the AWS steps? Also, I think that AMI must use Virtualization Type: paravirtualization, but I'm not sure how to set this.

arc1986 commented 7 years ago

@miha-plesko @gberginc , Ok its due to the application embed with the image, Other-than everything is fine.Thanks much for your inputs.

miha-plesko commented 7 years ago

Glad to hear that. If you can, feel free to drop a little more specific description of the actual problem here (mostly because I'm curious :D). I'm closing the issue.