Getting Started with Vagrant for Local Development

Other Providers Beyond VirtualBox

Other Providers Beyond VirtualBox

Local Stuff

VirtualBox is free and works great. For local development though, there are other options such as VMWare. You may want to use one of these for performance reasons or something else.

It's completely up to you. I have always done Virtual Box and have been very happy with it.

Server Stuff

Did you know Vagrant can also use third-party servers as providers?

That might sound crazy, but in a way it makes perfect sense. There are plugins that will allow you to use there servers instead of Virtualbox.

Some examples are:

  • Digital Ocean
  • AWS
  • Azure
  • Google Cloud
  • Linode

Now this isn't ideal clearly for local development, but it does help insanely with more complicated setups. Or, if you wanted to use Vagrant to build out a staging or production environment. Technically you could do all from your Vagrantfile.

Here's an example for AWS:

vagrant plugin install vagrant-aws
config.vm.provider :aws do |aws, override|
    aws.access_key_id = "YOUR KEY"
    aws.secret_access_key = "YOUR SECRET KEY"
    aws.session_token = "SESSION TOKEN"
    aws.keypair_name = "KEYPAIR NAME"

    aws.ami = "ami-7747d01e"

    override.ssh.username = "ubuntu"
    override.ssh.private_key_path = "PATH TO YOUR PRIVATE KEY"
end

Then:

vagrant up --provider=aws.

This will start your Vagrant instance on Amazon EC2! And, assuming your SSH information was filled in properly within your Vagrantfile, SSH and provisioning will work as well.