How to run Vagrant/Virtualbox on EC2 - amazon-web-services

I wrote a unittest that verifies the setup of my dev environment by using Vagrant to create a Virtualbox VM and then run through all the setup steps.
I'm not trying to run this unittest as part of my normal build process on a QA server running as an EC2 instance, and it's failing because EC2 is based on Xen and Virtualbox doesn't support Xen. Trying to install the latest Oracle Virtualbox with sudo apt-get install virtualbox-5.1 fails with the error:
vboxdrv.sh: failed: Running VirtualBox in a Xen environment is not supported.
Oddly, installing the vanilla Virtualbox package in Ubuntu's standard repo succeeds, although it doesn't provide the VBoxManage tool needed by Vagrant.
What's the easiest way to get Vagrant to be able to spin up a VM from inside an EC2 instance? Presumably, I could use an EC2 provider, but spinning up an EC2 instance over the network is much much slower and more complicated than creating a local instance.

Related

How can you run a proxmox server on a ubuntu EC2 instance

I would like to run a proxmox server on a Ubuntu EC2 Instance.
I know this may sound crazy but I do not have any spare hardware to run a promox server on. Would it be possible to run this on a Ubuntu EC2 Instance?
If i was to download proxmox on a flash drive, can i insert it into my computer and install it (overiding) the ubuntu instance and just using the hardware? Is this possible AWS?
It is possible to run Proxmox on EC2, but if you want to host VM guests you need to run on an instance type that supports nested virtualisation, which is only the "metal" instances. These start at about $4/hour.
Running containers works fine on any standard x64 instance type, though.
I posted a guide to installing Proxmox on EC2 here:
https://github.com/thenickdude/proxmox-on-ec2
The tricky parts that the guide fixes up automatically are harmonising the network configuration generated by Debian's cloud-init package with Proxmox's nonstandard ifupdown2 package.

How can I run Docker Desktop in an AWS EC2 Windows server environment?

Similar to this post from 2017.
Is it possible to run Docker Desktop from an AWS EC2 Windows server environment? Docker Desktop crash upon startup with the following error:
The Virtual Machine Management Service failed to start the virtual machine 'DockerDesktopVM' because one of the Hyper-V components is not running (Virtual machine ID 7A6D9FC6-1F84-450F-983C-C798BB55F8B7).
Running an AWS EC2 windows server with containers gives the following error when opening Docker Desktop:
Failed to deploy distro docker-desktop to C:\Users\Administrator\AppData\Local\Docker\wsl\distro: exit code: -1
If not, is it possible to run a docker container as well some other script/application (e.g python script) simultaneously on a single Ubuntu or Linux EC2 instance?

vagrant, puppet, aws but without vagrant on aws

So I have been googling for a while now and either I have completed the internet or I cannot articulate my search query to find the answer so I thought I would come here.
So my team and I want to use vagrant on our local machines which is fine. We want to use puppet for our configs. Now we don't want vagrant inside inside our AWS/DigitalOcean/Whatever providers instance. How do I get the puppet config to automatically build the instance for us ?
I am a little stuck, I think I need a puppet master but how does the AWS instance for example get built based on the puppet config and how does vagrant use the same config ?
Thanks
That's the default behavior if you install vagrant on your local workstation and configure an instance for AWS. Vagrant will connect over SSH to the instance and install client software (in this case puppet) to configure the instance.
In short: Vagrant will not install itself on any AWS-Instance.
Here's a link to the Vagrant-AWS Plugin:
Vagrant-AWS
Further information:
Vagrant uses providers to create VM's. The normal workflow is to use for example the virtualbox provider (which is build into vagrant) to create local VM's. You can set attributes for the specific provider in the Vagrantfile. In this case you need the Vagrant aws provider (which is a plugin -> vagrant plugin install <pluginname> command). Thus you can create VM's remotely. Just as with the virtualbox provider vagrant will not install itself on the created VM (remotely or not doesn't matter)
vagrant use masterless provisioning (Puppet Apply): script is running inside your vagrant box.
To provision machine in cloud you need puppet master server and puppet clients.
For automatically bootstrapping clients you can add shell script inside your server 'user-data': Digital Ocean , AWS EC2.
This script is responsible for installing puppet and connecting to master server.

What does vagrant-aws provide and how to use it in production version?

I have used Vagrant with default Virtualbox provider. It uses Virtualbox to simulate a OS, such as Ubuntu 14.04 on my local computer.
Vagrant has AWS provider as well. I have read the Official document, but I am confused about the following things:
Where does this provider runs on, my local computer or the AWS instance?
If it runs on my local computer and only simulates the AWS instance, why does the SSH key need to be set?
If it runs on the AWS instance, will the intended AMI, such as Ubuntu 14.04, being setup directly on the instance or through simulating tools used by AWS to simulate a OS on the instance, like what Virtual box does based on the local computer?
As Vagrant adds in overhead on the system by using Simulating Provider, whether is it a good idea to use Vagrant in production version? If not, how to put the Vagrant box into the production server, such as the AWS instance?

Create VM without OS with Vagrant

For testing of automated OS deploy on a hardware cluster, I need Vagrant to create few VMs without OS installed, with just network boot enabled.
I succesfully created base box image and configured boot order with Vagrant.
Problem is that Vagrant dies after waiting for VM to boot (which it doesn't, because it has nothing to boot), trying to set up ssh forwarding, shared folders etc.
Is there any way I can tell Vagrant to just power on the machine and not try to configure or boot it?
Vagrant's idea is to manage already installed boxes. It has some requirements for them. SSH or other login access is a fundamental one.
If you just want to spin up a VirtualBox VM, you can call VBoxManage etc. directly.