0
votes

I'm new to vagrant and aws.

I have a vagrant ubuntu image running in my laptop and I want to package it and deploy it into aws. How can I do this?

Here are what I have tried and found:

  1. vagrant package --output NAME.box This gave me a ~1GB .box file
  2. Found vagrant-aws and vagrant-aws/example_box in github, but it seems to me that it can only deploy a dummy/new box into aws not a existing one? correct me if I was wrong here.
  3. Also tried a work-around: I deployed a brand-new ec2 with a amazon machine image (ubuntu) and I upload the NAME.box file into this machine. And I tried to install vagrant and virtual box and manually do the vagrant up. But it told me I can't do it on a xen virtual machine.

Thanks in advance!

1

1 Answers

0
votes

I have a vagrant ubuntu image running in my laptop and I want to package it and deploy it into aws. How can I do this?

The short answer is its not possible - I would have thought that #3 as a workaround as well but if you say its not working ! and anyway I would not recommend.

why it does not work ?

Vagrant works with box, and each box is built for a particular provider. Default provider is VirtualBox, but you can have VMWare provider and also cloud provider such as AWS EC2. So, even if the vagrant flow would be the same (vagrant up, halt, destroy ...) the base box you use is not the same and you cannot apply an existing VirtualBox box to work with VMWare for example.

Found vagrant-aws and vagrant-aws/example_box in github, but it seems to me that it can only deploy a dummy/new box into aws not a existing one? correct me if I was wrong here.

no, you can use any box as you would do with other provider, but you need to base box (the initial one if you want) to have been made with this provider.

Lets say you start with the dummy box, and build your own things on it, you can package this AWS instance as a new vagrant box and use it.

How to create your own box ?

This might be a question you have. I would suggest you look at packer, a tool made by the same guys who built vagrant so its very complementary tool. This is the tool that helps you to create your vagrant box, you would start with an OS iso (for virtual box or VMWare) or a specific AMI for AWS EC2.

For ubuntu, you would need to look at http://cloud-images.ubuntu.com/locator/ec2/ to pick the correct AMI you want to use, you can use google to find packer examples such as https://github.com/octohost/ubuntu-14.04 which can easily be used as starting points.