Using the vCloud SDK for PHP: Part 2
In Part 1 of this series we went through the initial setup and ran a demo script to retrieve the contents of our VDC’s inventory. Now it’s time to deploy a vApp.
To be fair, this does involve a few lines of code. However, once you have the ability to create servers programatically, you gain the ability to scale your servers up and down based on demand, on metrics you choose. This is especially important if you are creating a hybrid solution using multiple Cloud providers?—?if you are using Elastic Load Balancing with AWS, chances are you need something similar for the vCloud end of your platform.
Once you have connected to the vCloud service the basic tasks are as follows:
- Define variables containing your VDC name, template name, and so on.
- Create SDK references to the objects you need to use.
- Define parameters for your new vApp.
- Create the vApp by instantiating it from the template.
- Power it on!
Set some initial variables
Here we just set some variables, which we will use when creating our SDK objects.
Create some SDK objects
Here we get references to the objects we need to use, and create SDK references for them.
Define parameters required for template instantiation
In other words?—?the settings we need to set for our new vApp!
Create the vApp
We can now instantiate the vApp, using the settings we defined earlier. Note the section that waits for the task to complete before continuing.
Once this runs you will see the vApp being created within the vCloud Director interface.
Power on the new vApp
Finally, we’re ready to go! Get a reference to the new vApp, and power it on.
Again, keep an eye on the vCloud Director interface?—?your VM will soon be ready to go.
Feel free to contact us if you’d like more information on the hybrid platforms we have deployed for customers?—?or if there’s an SDK subject you’d like to see covered in a future post, feel free to leave a comment below!
Posts in this series
Part 1: Initial Setup
Part 2: Deploying a vApp
Part 3: Adding Metadata
Our specialists have the answer