Home > Blogs > VMware vCloud Blog > Monthly Archives: April 2011

Monthly Archives: April 2011

VMware Hosting with PHP and The vCloud API

By David Elliott, Technical Director at StratoGen

Last week I had an interesting meeting with a software development company looking to move their products to a software-as-a-service (SaaS) model. It’s a common scenario these days and one which lends itself very well to VMware and in particular the vCloud Director cloud hosting platform.

One of the features they loved was the vCloud API which gives them the ability to deploy pre-configured virtual machines from a ‘master template’ on the fly. 

The great thing about the API is that it breaks down complex tasks into simple steps that can be achieved with just a few lines of code.  For our software company, this means the process of signing up new clients can be easily automated; configuring and deploying a new virtual machine for each new customer.

To demonstrate what this functionality would look like in real life I’m going to run through a simplified example written in PHP.  We’ll be using the vCloud SDK, which is a wrapper for the vCloud API consisting of a PHP class library, developer documentation and a number of example applications. VMware also provides API wrappers for Java and .Net developers.

Creating our development environment

We’ll use a Linux distribution (CentOS 5.5) onto which we install PHP 5.3.1 and the PEAR HTTP_Request2 library. These are the only prerequisites for the SDK. Interestingly, the pear library is still classed as beta at the time of writing..

I’m going to use the webtatic repository to quickly install our required packages as the versions supplied by CentOS are older than stipulated by the SDK. For a production environment, it would be better to build the latest versions from source.

So let’s get started. After installing CentOS we need to perform the following commands:

$ yum update

$ rpm -ivh http://repo.webtatic.com/yum/centos/5/`uname -i`/webtatic-release-5-1.noarch.rpm

$ yum –enablerepo=webtatic install php  php-xml   php-pear  php-mbstring.`uname -i`

$ pear install channel://pear.php.net/Net_URL2-0.3.1

$ pear install channel://pear.php.net/HTTP_Request2-2.0.0beta3

Lastly, download  the vCloud SDK for PHP which can be found at  http://www.vmware.com/go/vcloudsdkforphp. The SDK is available as a .zip for windows servers or .tar for Linux. Installation is simply a case of extracting the files into a suitable directory on your server.

The application

Here’s the code for our entire application: 

Small isn’t it! Let’s take a closer look at how it works.

The first section set’s the connection parameters to our vCloud Director server – in a VMware hosting environment this would be obtained from your service provider. Next, I set the parameters for my account. I have created a catalog and placed a vApp template inside it called “MyTemplate”. This will be customised and deployed by our script.


The real work comes in the 5 steps in the ‘try’ segment.
Step 1 logs in to the vCloud Director account. Steps 2 to 4 get references to my organisation, virtual datacentre and finally the vApp template. We are then ready in step 5 to deploy a new vApp from the template. Notice how I can do this in a single line of code.

After invoking the PHP code our new vApp is created.


Where next?

The example shows how a small amount of code can be very productive with the API. Of course we would need to add a lot to this before it is ready for production (in particular error checking!) but I just wanted to highlight how simple the API is to use, and hopefully inspire you to write some code of your own which leverages this powerful interface.

In my next post I hope to cover how we can use the API to implement auto-scaling by powering up additional servers in response to work load.

About StratoGen:

David Elliott is Technical Director of StratoGen, a leading VMware hosting provider with a worldwide client base. StratoGen hosted VMware products are based on vCloud Director and include a 100% uptime guarantee. For updates on future articles follow StratoGen on twitter, or subscribe to the StratoGen Blog.

Enterprise Private Cloud, Public Cloud & The Chaos Monkey

By David Davis

Last month at Cloud Connect 2011, thousands of people interested in cloud computing were brought together. Dubbed the meeting of the “entire cloud eco-system”, Cloud Connect’s keynotes were broadcast live on the web (I watched many of them). One of the most important speakers, in my opinion, was VMware’s Mathew Lodge (on Twitter as @MathewLodge), VMware’s Senior Director of the Cloud Services group.


What Is A Chaos Monkey?

The first time I looked at Mathew’s presentation (slides posted here) entitled “Escaping the Chaos Monkey – Enterprise vs. Commodity Cloud”, my first thought was “what the heck is a chaos monkey?”

You may have the same initial thought so I’ll offer this straight up. A “chaos monkey” is:

Invented by NetFlix as a way to simulate what it would be like to host their production servers on a public cloud, "The Chaos Monkey’s job is to randomly kill instances and services within [Netflix's] architecture" (according to Mathew). Built to simulate a commodity public cloud in enterprise datacenters, the chaos monkey and other animals shed light on the fundamental differences in architecture, approach and philosophy between commodity and enterprise public clouds.

In other words, the “chaos monkey” was created by Netflix to demonstrate the seemingly random performance and reliability levels that you might get from a public cloud. The point of the chaos money is to show that there is a big difference between enterprise private cloud and public cloud.

Like I once did, you might think that “a cloud is a cloud”, right? Wrong.

Comparing Enterprise Private Cloud and Public Cloud

Also in Matthew’s presentation, I went on to learn about the many differences between enterprise private cloud and public cloud. Here are some of them:

Enterprise Private Cloud

  • It’s yours, you own it and control it
  • More predictable and reliable
  • More secure
  • On demand computing for an existing application

Public Cloud

  • Could have “noisy neighbors”
  • Applications may have to be redesigned and this could cause failure
  • Performance may be unpredictable at times
  • Transition has to be made and it could be tough. There is a lot more to the transition than just “moving a VM”
  • More ideal for a newly written application that was architected for the public cloud

In The End…

As with most things in life, the two extremes aren’t usually the best fit for most people. The ideal solution is “somewhere in the middle”. That middle-ground is the “Hybrid Cloud”.


There are certainly some companies who have only one type of application. For those companies, the enterprise private cloud or the public cloud may be ideal (depending on the type of app). But for most companies who have a mixture of application types, the ideal fit is going to be the hybrid cloud. With the hybrid cloud, apps can run in either the public or the private cloud and even move back and forth. VMware vCloud Connector is the software that makes this possible. In the end, I enjoyed Mathew’s presentation and I hope that I get to hear him speak again.

Click here for more information on vCloud Director or the new vCloud Connector, which creates Hybrid Clouds.

David Davis is a VMware Evangelist and vSphere Video Training Author for Train Signal. He has achieved CCIE, VCP,CISSP, and vExpert level status over his 15+ years in the IT industry. David has authored hundreds of articles on the Internet and nine different video training courses for TrainSignal.com including the popular vSphere video training package. Learn more about David at his blog or on Twitter and check out a sample of his VMware vSphere video training course from TrainSignal.com.


Virtacore’s vCloud Express is live!

Matthew D. Sarrel, Sarrel Group

Since December, I have been updating blog readers on the evolution of Virtacore’s vCloud Express Beta. Virtacore’s beta trial ended earlier this month, and I’m happy to report that as of today, vCloud Express is now live!

vCloud Express is a public cloud offering based on VMware technology, providing virtual servers from Virtacore’s shared resource pool for a low monthly cost, following a utility computing model where you only pay for the resources and bandwidth that you use. Virtacore has also created a Unified Management Portal that allows you to control and move data to and from vCloud Express and Virtacore Private Clouds. Virtacore’s Unified Portal is a VMware-based platform that makes it easy to migrate workloads to and from public, private and corporate clouds.

Cloud Solutions Graphic3

Currently, Virtacore is the only provider that offers vCloud Express using vCloud Director 1.0.

For more information on Virtacore’s vCloud Express, check out their website. Also, be sure to follow me on Twitter (@msarrel) for regular updates on Virtacore, vCloud, and the VMware Service Provider community.

Matthew D. Sarrel (or Matt Sarrel) is executive director of Sarrel Group, a technology product testing, editorial services, and technical marketing consulting company.  He also holds editorial positions at pcmag.com, eweek, GigaOM, and Allbusiness.com, and blogs at TopTechDog.