Create VM by REST API without vCenter

Ali Dehqan picture Ali Dehqan · Jul 25, 2017 · Viewed 9.6k times · Source

Is it possible to create VM (or any other tasks) by REST API with a server running ESX without vCenter?

Or it is essential to install vCenter on the server?

I checked these links but they use vCenter:

https://www.youtube.com/watch?v=14WeRVv3NDo https://blogs.vmware.com/code/2017/02/02/getting-started-vsphere-automation-sdk-rest/

Answer

Kyle Ruddy picture Kyle Ruddy · Jul 25, 2017

VMs can be created through either the vSphere Client or the vSphere Management API. There is no requirement to install a vCenter server.

Example to create VMs through the vSphere Client: https://www.youtube.com/watch?v=ddUs5FsczzY

Example to create VMs through the open sourced pyvmomi SDK: https://github.com/vmware/pyvmomi-community-samples/blob/master/samples/create_random_marvel_vms.py

Example to create a VM through the open sourced rbvmomi SDK: https://code.vmware.com/samples/781/create-vm?h=vm%20create

This can be done through several other SDKs as well with the usage of the CreateVM_Task method.

Additional information about this method is available here: http://pubs.vmware.com/vsphere-6-5/index.jsp?topic=/com.vmware.wssdk.apiref.doc/index.html&single=true

Then select 'All Methods' and search for 'CreateVM_Task'