1

I have packer configured to use the amazon-ebs builder to create a custom AMI from the Red Hat 6 image supplied by Red Hat. I'd really like to packer to post process the custom AMI into a virtualbox image for local testing. I've tried adding a simple post processor to my packer json as follows:

  "post-processors": [
      {
        "type": "vagrant",
        "keep_input_artifact": false
      }
  ],

But all I end up with is a tiny .box file. When I add this to vagrant, it just seems to be a wrapper for my original AMI in Amazon:

$ vagrant box list
packer                                                (aws, 0)

I was hoping to see something like this:

rhel66                                                (virtualbox, 0)

Can packer convert my AMI into a virtualbox image?

MarkT
  • 341
  • 3
  • 4
  • Possible duplicate of [Convert Amazon EC2 AMI to Virtual or Vagrant box](http://stackoverflow.com/questions/21920993/convert-amazon-ec2-ami-to-virtual-or-vagrant-box) – Frederic Henri Oct 24 '16 at 13:59
  • What happens when you run `vagrant up` on the image created? – Tiz Oct 25 '16 at 13:15
  • I get this:`vagrant up Bringing machine 'default' up with 'virtualbox' provider... ==> default: Box 'awsami' could not be found. Attempting to find and install... default: Box Provider: virtualbox default: Box Version: >= 0 ==> default: Box file was not detected as metadata. Adding it directly... ==> default: Adding box 'awsami' (v0) for provider: virtualbox default: Downloading: awsami An error occurred while downloading the remote file. The error message, if any, is reproduced below. Please fix this error and try again. Couldn't open file awsami` – MarkT Oct 27 '16 at 14:08

1 Answers1

0

Post-processor in your example just gives you the vagrant for that image. That image was aws, so no it didn't change anything. To change it to virtualbox you'd have to convert it.

Per the docs have you tried:

{ "type": "virtualbox", "only": ["virtualbox-iso"], "artifact_type": "vagrant.box", "metadata": { "provider": "virtualbox", "version": "0.0.1" } }

The above is untested. AWS provides some docs on exporting here

Marc Young
  • 3,854
  • 3
  • 18
  • 22