title: How can I make an EBS volume with a raw image bootable?
body: <p>I am trying to create an AMI from the raw images here:</p>
  
  <p><a href="http://cloud-images.ubuntu.com/releases/xenial/release/ubuntu-16.04-server-cloudimg-amd64.tar.gz" rel="nofollow noreferrer">http://cloud-images.ubuntu.com/releases/xenial/release/ubuntu-16.04-server-cloudimg-amd64.tar.gz</a></p>
  
  <p>Here are the steps I'm taking:</p>
  
  <ol>
  <li>Log into existing Ubuntu instance</li>
  <li>Create, attach and mount the EBS volume</li>
  <li>Download and extract image from cloud-images.ubuntu.com</li>
  </ol>
  
  <p>4.
  dd extracted image to attached volume /dev/xvdf </p>
  
  <pre><code>time sudo dd if=cloudimg-amd64.img of=/dev/xvdf conv=sync,noerror bs=1M
  </code></pre>
  
  <ol start="5">
  <li>Detach volume, snapshot volume, create ami from snapshot</li>
  </ol>
  
  <p>When I try to launch the AMI it fails with hard disk not bootable.</p>
  
  <p>In addition to the above also tried using ec2-import-instance</p>
  
  <pre><code>  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
  </code></pre>
  
  <p>but it appears --format raw actually doeesn't mean what it says, it doesn't create a bootable AMI and fails with </p>
  
  <pre><code> Client.Unsupported: No valid MBR found. Please verify your image.
  </code></pre>
  
  <p>So how can I manually make a volume bootable (or create an AMI) from a raw image obtained from cloud-images.ubuntu.com?</p>
  
  <p>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.</p>
  
  <p>I also tried aws ec2 import-image method, that doesn't work either for any format.</p>