I need to setup a web server and a database server on EC2.
It should be easy to migrate to another service provider later.
Currently, I have a web server and a database server, each running on separate EC2 micro instances with software installed there remotely.
Can we run a vagrant box on these micro instances with pre-installed and pre-configured softwares like LAMP stack and use that instead. So I will end with 2 vagrant boxes , one for web server another for database server.
Amazon provides already means to copy an instance but it is copied to another EC2 instance only probably .. If there is need to move to some other provider, it will be same process of re-installing all. So, an own virtual box installed on Amazon's virtual box is what i was looking into..
I don't know how good or bad it is.. I doubt if this will affect performance as well. Please share your views. Target is to have env prepared locally and have flexibility to deploy it on any service provider easily.
Running vagrant inside your AWS box is probably not the right solution. Have you looked into the Vagrant AWS provider?
That will allow you to setup and provision your AWS boxes with Vagrant and Puppet or Chef... if you are using Puppet or Chef to provision your servers then you will have a very portable "scripted" install for your servers that can easily be moved to another provider at a later date...
So running a virtual machine, on another virtual machine probably isn't the best. But if you want to install Vagrant on Amazon Linux you can do:
wget https://releases.hashicorp.com/vagrant/2.2.4/vagrant_2.2.4_x86_64.rpm
sudo rpm -ivh vagrant_2.2.4_x86_64.rpm
The RPM is the Centos version from the downloads page here: https://www.vagrantup.com/downloads.html
But then you cannot install virtualbox to run a VM. So it doesn't actually work anyways.
Related
I am a web developer and I am currently using Vagrant + VirtualBox to run my projects. I have a Proliant server at home that I am not using at the moment. I was thinking, is there any way I could use it instead of the VM, so I could run my projects remotely?
P.S: Can you think about any other cool use cases for this server?
Vagrant is design to work with VMs or containers when using a docker provider but not bare metal server simply because the goal is to be able to build, use, destroy and rebuild environment programmatically so using a base-metal server break the main use case.
The possible course of action is to install the hypervisor on your personal server and then configure your Vagrantfile to use the remote provider instead of the local. You'll have as a direct benefit the ability to create a lot of instance since your server will most likely have more resources than your local laptop/desktop workstation.
I have:
a machine on amazon I can ssh to
Vagrantfile and resources it uses to automate a process.
How can I tell my vagrant to use the machine I have? (I don't want to spin a new machine)
currently doing stuff manually.
also cannot use docker (project requirement).
I found this awesome vagrant plugin that answers my needs
https://github.com/tknerr/vagrant-managed-servers
You can't
Basically, vagrant needs a box to create the VM to work with. You would not be able to create a base box from your running EC2 instance (vagrant package only works with VirtualBox)
You would be able to spin new EC2 instance from a specific EC2 box (or create a box yourself for the EC2 provider) but for your existing instance, you'll need to continue working with ssh
Can we use vagrant to provision multiple services in a single virtual machine , say tomcat and mysql. but a service should get installed in VM as per user input something like "vagrant up mysql".
I have already been looked in to Mutiple VM deployment using vagrant but here what i want is to have services in same VM based on user input.
Is there a way to do that?
Thanks!!
Since all those machines are virtual and you sometimes want to have only mysql there, sometimes only tomcat and sometimes both, just use multi-machine:
http://docs.vagrantup.com/v2/multi-machine/
Then you will be able to start your machine, for example, like this:
vagrant up mysql
vagrant up tomcat
vagrant up both
You can configure them to have the same IP and never start all of them at once. This should work for you.
I was reading through Rackspace's article about using Vagrant with Rackspace open cloud which shows you how you can use a vagrant vm that is hosted on a Rackspace server.
I'm wondering if there's any way that I could work from a vm that is provisioned like a Rackspace server on my local machine via Vagrant. I can't seem to find a box specifically for emulating Rackspace servers and I can't find information on what base OS and basic tools rackspace cloud servers actually use so I could provision my own environment.
Is there a place where I can find a rackspace specific vagrant box or at least find out the os info?
Edit:
Correction, it is possible, but it takes a few steps:
Export (from Rackspace) the image that you want to run locally see here for more info
Download image from Cloud Files
Convert/import the vhd file into VirtualBox see this for example
At this point, you should be able to use that image with Vagrant to run a Rackspace image locally.
So at work we run a bunch of sites on rackspaces cloud sites platform. This works alright, except I have no way of tweaking anything server side and I find that they sometimes aren't as responsive as they could be.
Let's assume that most of the sites are bloated wordpress installations.
Would it be possible to use EC2 micro instances to host these? (One instance per site)?
I want to move away from rackspace as I have no flexibility with cloud sites and prefer Amazons services.
Sure! You can easily do that!
Sign up for EC2 here.
Go to http://alestic.com/ and chose AMI (Ubuntu AMIs for EC2 drop-down) you want to start instance from.
Start EC2 Micro Instance by hitting the links (or use API Tools). You can use user-data to install desired software on instance start, but I recommend (for simplicity) just to start Instance and install software via terminal using SSH. Follow the dialog and create RSA key to connect your Instance.
Connect to your Instance over ssh using RSA key.
Install software. For example: sudo su, then apt-get update && apt-get install -y ntp php5-fpm nginx wordpress [...].
Create AMI from running Instance with installed and configured software.
Launch more Instances from your own AMI bundled with Wordpress and stuff!
Full disclosure: I am a rackspace employee.
If you want more flexibility than rackspace cloud sites, then you can use rackspace cloud server. You will have all the flexibility of the cloud. If you like the managed part of cloud sites, then i would suggest managed cloud server.