Exploring IBM Bluemix – Part 5: Virtual Machines

5.00 avg. rating (93% score) - 1 vote

This article explores the possibility of running virtual machines on IBM Bluemix, provided you with more freedom in customizing your server environment while still enjoying the existing wide range of Bluemix services not currently offerred by other VPS providers.

To get started, click on Virtual Machines on the left menu of your dashboard, and then click on Create Virtual Machines to add a new virtual machine. You will be prompted to select the preferred hardware configuration:

add_vm_details

Only two configurations are available (1.5GB RAM, 1 CPUs, 10GB HDD vs 3.1 GB RAM, 2CPUs and 20GB HDD). This is quite limited compared with other providers (Amazon EC2, Windows Azure or even Digital Ocean) that provide dozen of configurations to choose from.

Some common Linux distributions such as Redhat, Ubuntu, CentOS and SuSE are available for selection:

vm_os_choices

Interestingly, there is also an option for you to upload an existing image, either from a URL or from a local file, subject to the maximum size limitation to be used. Common image formats such as VirtualBox VDI, VMWare vmdk or even ISO are supported:

upload image format

I was thinking of using this option to upload a Windows XP VDI image from my local VirtualBox installation and see if it could run on IBM Bluemix. Unfortunately, the Bluemix portal repeatedly timed out after just 10 minutes attempting to upload my ~900MB barebone Windows XP installation. The option to upload from URL also did not work and simply refreshed the page. There is also no option to upload a compressed file to be extracted by the server. So for now, I have to live with the small set of Linux images provided by IBM.

On the bright side, something I like about this interface is the ability for me to create SSH key on the spot without having to resort to command line utilities, like other providers such as Google Compute Engine. I can choose between importing an existing key or create a new key:

add_ssh_key

With the SSH key ready, click on the Create button to set up the virtual machine. The Bluemix dashboard will report “Building your VM” and after a couple of minutes will report the following error:

vm_creation_failed

The mesage reads “Resource CREATE failed: NotFound: External network xxxx is not reachable from subnet xxxx. Therefore cannot associate Port xxxx” and was most likely returned from OpenStack, the underlying platform that powers IBM Bluemix.

To overcome this, you must adjust the network configuration using the Horizon Dashboard (actually a white-labelled version of the OpenStack dashboard) provided by Bluemix. Go back to your Bluemix dashboard, click on Create Virtual machines and without actually creating any new machine, click on Launch Horizon Dashboard at the bottom of the dialog. Take note of the credentials presented in the popup to locate your Horizon Dashboard:

horizon dashboard

Once logged in, you will reach the Cloud Management Dashboard, a whole new world! After that open the Network Topology section and you will see the following diagram:

network_topo

To fix the error, we need to make the private network visible through the public network with the following steps:

  1.  Opening Network > Routers > Create Router
  2.  Choose to create a new router, accepting most of the default settings
  3.  In the router entry which was created, click Set Gateway in the Actions column

When done, the network topology will look like below:

network-topo-router

At this point, create the virtual machine again and it should succeed, showing in the dashboard with its public IP:

ubuntu public ip

If the machine is created but there is no public IP assigned to the machine, open Computer > Access & Security > Floatings IPs and associate a new IP for the machine. If the machine has an IP but is not accessible via SSH or ping, you may need to reboot the instance from Compute > Instances. For some reasons the instances which were created for the first time were not accessible until a reboot during my test. If this is the case for you, try a soft reboot first before trying a hard reboot. Take note that a newly created instance may take up to 15 minutes before it is accessible, so please be patient.

Interestingly, the Cloud Management Dashboard also allows you to create a new virtual machine instance via the Launch Instance wizard:

create_vm_instance

However, the list of the virtual machines in the Cloud Management Dashboard and on the Bluemix dashboard will not be in sync if an instance is created using the Launch Instance button. Once they are out of sync, any subsequent attempts to access the instances will result in unexpected behaviour. I guess this scenario has yet to be handled by the beta release of IBM Bluemix. So for now, only create your instance from the Bluemix dashboard to be safe.

The following is an SSH console to an Ubuntu virtual machine running on Bluemix. The default SSH login username is ibmcloud – no password is required for SSH login once the key is provided:

ubuntu running finally

Almost immediately, I noticed that the default shell uses dash as the shell not bash, so features like history will not be available. I could not change the shell to bash using chsh -s /bin/bash, which just failed with message You may not change the shell for ‘ibmcloud’.  The default command prompt will just be $, so you will need something like export PS1=’$(whoami)@$(hostname):$(pwd) # ‘ to make the command prompt show the current directory. Some operations will ask for the sudo password, which is not known. Also, attempting to activate and use the root account will result in a message saying that root account is not available.

On the other hand, the default CentOS image uses bash as the shell and has no such restrictions. I was able to set up a mini web server with PHP/MySQL within just over an hours from the CentOS image without encountering any major challenges. So I guess CentOS would be a better choice if you have to use virtual machines with IBM Bluemix at this stage, when other distribution images have yet to be fully tested.

A feature of Bluemix virtual machines not commonly found in other providers is auto-scaling, which allows the system to automatically add more instances if the CPU usage exceeds a certain threshold. You can configure this from your virtual machine settings in Dashboard:

auto scale settings

Finally, although I did get my mini CentOS-based web server to run on Bluemix, I must say that the virtual machines capabilitie provided by Bluemix are still quite unstable at this stage. During my three days experimenting, I encounted countless timeouts, funny error messages and wierd behaviours, for example the unexpected change of the Bluemix interface language to Chinese at one point, even though no such option is available from the interface:

chinese languages

I hope that these limitations and issues will be addressed in the next release so that users can confidently use Bluemix virtual machines in their production environments.

5.00 avg. rating (93% score) - 1 vote
ToughDev

ToughDev

A tough developer who likes to work on just about anything, from software development to electronics, and share his knowledge with the rest of the world.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>