Vagrant is awesome tool for creating and sharing environments running in VirtualBox, Vmware, Hyper-V, etc.
But nowadays we may need to run AWS Linux as well as CentOS, Ubuntu and Windows.
Powerful IDEs such as PyCharm can wok with Vagrant machines, which is really useful, e.g. while debugging scripts.
So in this post I’ll show you how to do it.
1. Install aws plugin:
vagrant plugin install vagrant-aws
2. Clone Vagrant box (it contains only metadata.json with aws provider):
vagrant box add aws https://github.com/mitchellh/vagrant-aws/raw/master/dummy.box
3. Check available options: https://github.com/mitchellh/vagrant-aws
4. Create Vagrantfile, see my example:
[pastacode lang=”bash” user=”kagarlickijd” repos=”vagrant” path_id=”aws/Vagrantfile” revision=”” highlight=”” lines=”” provider=”github”/]
5. Open PyCharm, install Vagrant plugin and set Vagrant executable which is in the /opt/vagrant/bin/vagrant by default;
6. Now you are able to use Vagrant from PyCharm:
7. But there’re some limitations: rsynс is used for vagrant folder sync, so you need to run vagrant reload to see a new content.
However you can use git, S3 or FTP to sync content.
Visual Studio Code is another nice IDE, it’s light and free, but not so comfortable as PyCharm.
To use Visual Studio Code with Vagrant install vscode-vagrant plugin and check available options:
As you can see, from Visual Studio Code you can also run ssh.
You can install Vagrantfile Support plugin in Visual Studio Code to highlight Vagrantfile syntax:
There’s no native plugin to support Vagrantfile in PyCharm, but you can associate Vagrantfile with bash plugin syntax highlight:
But it’s not a very good idea, because Vagrantfile is simple and you probably won’t need even syntax highlight.
Vagrant for DevOps table of contents