4 minute read

Originally posted on https://developer.ibm.com/opentech/2016/02/16/creating-a-new-virtual-machine-on-bluemix

First impressions are pretty important. Bluemix, IBMs one-stop-shop for all things cloud has been out for a while now, I’ve played with it when it was in closed-beta, but now it’s out in the wild! I figured I would write about my thoughts using the service, specifically I’ll take a look at the simple task of requesting a virtual machine (VM). My main use case for wanting to create a VM on bluemix is to setup a ZNC bouncer, I needed a VM on a cloud that’ll give me a public IP address so I can check OpenStack development happening on IRC from anywhere – my laptop or even my phone.

Accessing Bluemix

It’s worth noting that Bluemix is built on Cloud Foundry and powered by OpenStack, which is all kinds of awesome! To get started, I went to bluemix.net, I was able to log in using my IBM ID (which isn’t my work credential, anyone can have an IBM ID, but if you’re an employee it is linked to your employee ID – magic).


Upon logging in, we are presented with a dashboard, it contains a bunch of shortcuts to common actions and an overview of things you’ve created. I really like the shortcuts at the top, Create App, Start Containers, Run Virtual Machines, etc, it’s all there, no digging around the menus trying to figure out where to go. We can also see the VM I created earlier, my trusty ZNC bouncer. So let’s try to create another VM.


Create your keypair

Before creating the VM, we have to create a public/private keypair so we can securely connect to our new host. On your personal computer, create a public/private key pair, I omitted some of the output for the sake of readability. But essentially, my public key that I’ll upload to Bluemix is at /Users/stevemar/.ssh/test_bm.pub

smartinelli-mac:~ stevemar$ ssh-keygen
Generating public/private rsa key pair.
Enter file in which to save the key (/Users/stevemar/.ssh/id_rsa): /Users/stevemar/.ssh/test_bm
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /Users/stevemar/.ssh/test_bm.
Your public key has been saved in /Users/stevemar/.ssh/test_bm.pub

Customize your VM

Now let’s actually create the VM in Bluemix. Upon clicking the Run Virtual Machines button, I’m presented with a panel that allows me customize my new VM, which I’ve aptly named test_bm. I’m pleased to see that there are a handful of Linux images available by default. I went with Ubuntu 14.04. It looks like you can also upload and create a new image, I did not try this option. By picking the Ubuntu 14.04 image, the UI informs me that a default non-root user already created, this user is named ibmcloud. There were also only two flavors available, m1.small and m1.medium. Since this was only a test, I selected the m1.small option.


Import your key

Before selecting the Create option, I had to add a new public keypair. To do this, select the Add Key option, which brings up the following panel:


I gave my keypair a simple name, and copied the contents of /Users/stevemar/.ssh/test_bm.pub into the text box. An example of what a public key looks like can be seen below, again trimmed for the sake of readability:

smartinelli-mac:~ stevemar$ cat /Users/stevemar/.ssh/test_bm.pub
ssh-rsa AAAAB3NzaC1...4ZKi3BnxXU/ stevemar@smartinelli-mac

Now that you’ve imported your public key, go ahead and press that CREATE button!

Viewing your VM

Once the VM has been created, you’ll be directed to a page that shows VM information. Not much to do on this page; there are options to delete, stop, restart and suspend your VM, but let’s try accessing it. The public IP is available at the top of the page.


Accessing your VM

From a terminal use ssh. In my case, I’m using a non-default location for my keypair, and remember, we have to specify the ibmcloud account when accessing the VM.

smartinelli-mac:~ stevemar$ ssh ubuntu@public_ip -i ~/.ssh/test_bm
The authenticity of host 'public_ip (public_ip)' can't be established.
RSA key fingerprint is 22:06:7f:d6:98:ad:7f:20:82:0e:4d:13:d0:c4:34:79.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'public_ip' (RSA) to the list of known hosts.
Welcome to Ubuntu 14.04.1 LTS (GNU/Linux 3.13.0-24-generic x86_64)

 * Documentation:  https://help.ubuntu.com/

The programs included with the Ubuntu system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.


Voilà! Now you have your very own VM on a public cloud, maybe it’s time to setup that ZNC bouncer?

A few final thoughts

Given the VM service in Bluemix is in open beta, a few hiccups are expected. Two flavors seems okay for now, but there definitely need to be more, a nano sized flavor would be sufficient for a ZNC bouncer. Also, there seems to be no way to manage keys once created, I wasn’t able to delete the keys I had imported. On a positive note, I am pleased to say that I’ve been running my bouncer for a while, and downtime hasn’t been an issue at all.


Matt Kelm also has a write up on how to import different images and use them instead.