In this blog I will intruduce you into the basics of vcd-cli and multitude of possibilities this tool offers.
vcd-cli is a command line interface for vCloud director and is being maintained by VMware.
I feel that vcd-cli is a powerful tool that can make your daily tasks a but easier.
For certain tasks I find vcd-cli to be easier to use than for instance PowerCLI, espacially when it comes down to VM resource management.
Installing the package
On of the first things you need to do before you can start using vcd-cli is install the package on your machine.
The package is available for:
- Windows
- Linux
- Photon OS
- Mac OS X
You can also add additional extensions for vcd-cli like container-service-extension so that you can work with kubernetes in vCloud director. Of course this will only work if you have the CSE extention installed. More info on CSE can be found here
Using vcd-cli
Now lets have a look what we can do with vcd-cli.
To get started you need to login using the vcd-cli:
vcd login <vcd fqdn> <tenant name> <username>
Now that I am logged in we can start by listing all the command available to us using the vcd –h command
As you can see you have quit a view commands at your disposal.
Now lets see what we can do with these commands
Adding a vApp
vcd vApp create <vApp name>
Power off a VM
vcd vm power-off <vapp name> <vm name>
Adding CPU and Memory resources to a VM
As mentioned before resource management is easier in my opinion then with PowerCLI.
Below a example of a VM called “CentOS6” that is in need of some more power.
Lets first see the amount of resources currently assigned to the VM:
vcd vm info <vApp name> <vm name>
And as you can see the VM currently has 2 CPU’s assigned and 1 GB of memory.
Now lets change that to 4 CPU’s and 2 GB of memory like so:
vcd vm update <vApp name> <vm name> –memory 2048 –cpu 4
The command completed successfully, lets check to see if this is indeed the case by running the vcd vm info command again:
And voila my VM now has 4 CPU’s and 2 GB of memory.
I hope I have been able to give you some insides into the basics of vcd-cli.
To find out more information regarding vcd-cli please visit http://vmware.github.io/vcd-cli/
Here you will find installation instructions but also a list of all the commands available when using vcd-cli.
Check our other vCloud Director related articles here