Reputation: 43
I am trying to create an AMI from the raw images here:
http://cloud-images.ubuntu.com/releases/xenial/release/ubuntu-16.04-server-cloudimg-amd64.tar.gz
Here are the steps I'm taking:
4. dd extracted image to attached volume /dev/xvdf
time sudo dd if=cloudimg-amd64.img of=/dev/xvdf conv=sync,noerror bs=1M
When I try to launch the AMI it fails with hard disk not bootable.
In addition to the above also tried using ec2-import-instance
ec2-import-instance --architecture x86_64 --platform Linux --bucket mybucket --volume-size 5 --availability-zone us-east-1d -O ID-REMOVED -W ID-REMOVED -o ID-REMOVED -w ID-REMOVED --instance-type t2.micro --format raw xenial.img --subnet subnet-12345678
but it appears --format raw actually doeesn't mean what it says, it doesn't create a bootable AMI and fails with
Client.Unsupported: No valid MBR found. Please verify your image.
So how can I manually make a volume bootable (or create an AMI) from a raw image obtained from cloud-images.ubuntu.com?
Note: I need to be able to do this from the RAW EC2 images at cloud-images.ubuntu.com, copying existing AMI's is not an option.
I also tried aws ec2 import-image method, that doesn't work either for any format.
Upvotes: 0
Views: 1662
Reputation: 43
I solved this by using the Amazon CLI, specifically this command:
aws ec2 import-snapshot
Then I created a volume with a bootable partition and copied the snapshot to it.
RAW images must be imported as snapshots.
Upvotes: 2