def bundle_and_register(img=nil, opts={})
      opts = {:cert         => cert,
              :bucket       => nil,
              :prefix       => image_id,
              :kernel       => kernel_id,
              :ramdisk      => ramdisk_id,
              :ec2cert      => cloud_cert
              }.merge(opts)
      raise "You must specify a bucket to bundle to" if opts[:bucket].nil?
      scp ec2cert, "/mnt/bundle/"
      scp cert, "/mnt/bundle/"
      arch = self[:instanceType].match(/m1\.small|c1\.medium/) ? 'i386' : 'x86_64'
      image = img ? img : make_image(opts)
      ssh "ec2-bundle-image #{image} -d /mnt/bundle -u #{self[:ownerId]} -k /mnt/bundle/pk-*.pem -c /tmp/cert-*.pem"
      manifest = "/mnt/bundle/#{opts[:prefix]}.manifest.xml"
      ssh "ec2-upload-bundle -a #{access_key} -s #{secret_access_key} -m #{manifest}"
      ami_str = ssh "ec2-register-bundle"
      ami = ami_str.grep(/ami-\w*/).first
      return ami
    end
def bundle_and_register(img=nil, opts={})
      opts = {:cert         => cert,
              :bucket       => nil,
              :prefix       => image_id,
              :kernel       => kernel_id,
              :ramdisk      => ramdisk_id,
              :ec2cert      => cloud_cert
              }.merge(opts)
      raise "You must specify a bucket to bundle to" if opts[:bucket].nil?
      scp ec2cert, "/mnt/bundle/"
      scp cert, "/mnt/bundle/"
      arch = self[:instanceType].match(/m1\.small|c1\.medium/) ? 'i386' : 'x86_64'
      image = img ? img : make_image(opts)
      ssh "ec2-bundle-image #{image} -d /mnt/bundle -u #{self[:ownerId]} -k /mnt/bundle/pk-*.pem -c /tmp/cert-*.pem"
      manifest = "/mnt/bundle/#{opts[:prefix]}.manifest.xml"
      ssh "ec2-upload-bundle -a #{access_key} -s #{secret_access_key} -m #{manifest}"
      ami_str = ssh "ec2-register-bundle"
      ami = ami_str.grep(/ami-\w*/).first
      return ami
    end
TODO: WIP:  bundle up the instance and register it as a new ami.
 An image of the running node will be creatd, or
 if a path to an image file on the remote node is given, that will be used