Recently I’ve been using vCloud Air a lot, for both proof-of-concept and spinning up my own lab machines. But for some reason I just don’t gel with the UI. It’s not particularly bad, I just don’t find it very intuitive. So I set off in search of another tool, and found the VCA-CLI.
This is a handy command-line tool for managing vCloud Air and vCloud Director, primarily aimed at *nix/Mac users (in my case the latter). It is installed using PIP, a package management system for Python software packages.
If you’re interested in installing it on Mac OS X, then there are two methods available. The first is to use Homebrew. Anthony Spiteri has documented a fantastic howto which can be found at http://anthonyspiteri.net/how-to-install-pip-and-vca-cli-for-vcloud-airdirector-on-os-x.
As I don’t compile a lot of packages on Mac (and hence have no need for Homebrew), I decided to take the native option, which consisted of running the following in Terminal:
xcode-select --install sudo easy_install pip sudo pip install vca-cli
Unfortunately when I ran my first vca command I got a bunch of errors. This was easily fixed by running:
sudo pip install vca-cli --upgrade
Getting started
VCA-CLI gives you the ability to do a number of handy things. In the following example I will connect to vCloud Air, select my instance, check the firewall rules are in place to allow traffic, then finally create an Ubuntu virtual machine and power it on.
Login to vCloud Air (substitute accordingly):
vca login virtualhobbit@virtualhobbit.com
View available instances:
vca instance
This should give you something like:Select your instance (substitute accordingly):
vca instance use --instance c2928f3e-????-493e-????-9b943fbd0e38
After configuring a VPN between my on-premises network and vCloud Air, I need to check the firewall rules are configured to pass traffic:
vca firewall
In my case, this gives:Next let’s create an Ubuntu Server VM with 2 CPUs and 8GB of RAM. First, we need to see what templates are available in the public catalog. To do this, use:
vca catalog
Create the vApp (and VM):
vca vapp create --vapp vca-cliTest --vm myVm --catalog 'Public Catalog' --template 'Ubuntu Server 12.04 LTS (amd64 20150127)' --cpu 2 --ram 8092 --network default-routed-network
Power it on:
vca vapp power-on --vapp vca-cliTest
Finally, retrieve the IP info for the new VM:
vca vm
When done, simply use the following to disconnect:
vca logout
Moving on
There a number of things you can do with the VCA-CLI. For a list of commands, check out the GitHub page at https://github.com/vmware/vca-cli.