Project VILMA

Sometimes, I get home and just wish I could say to my virtual machine in the cloud, “magico presto, turn on!” and it’s on and ready for me to remote into and do things. I wanted to do things to make that happen, but time and procrastination happens to many. Thankfully, there was an upcoming developer gathering that I used as the catalyst to actually build a system that would work, almost like magic.

So, last Sunday, the Port of Spain chapter of GDG (Google Developer Groups) held a developer event, #GDGPOS #DevFest. They reached out to the local developer community for interesting projects and I responded with a proposal to build something that would work in the way I described.

gdg-presenters
GDGPOS Presenters

My proposal got accepted and I spent a few weeks building out the idea. My whole solution involved using my Google mini to turn my virtual machine on or off.

To do that, I created a Google Action on the Google Actions console. I had played around with Actions before, but this would be different. I have been making most of my conversational agents using Microsoft’s Bot FrameworkBot Framework, so a lot of the concepts were familiar to me, from things like Intents, to Utterances and even the use of webhooks. For this action, I largely had to focus on just one Intent – the one that would hear a command for a VM state change and execute. Overall, the system would look like this:

VILMA-diagram

  • Creating the action

So, I created this custom Intent that took me to Dialogflow, Google’s interactive tool for building conversational interfaces. There, I created a custom intent, ChangeVMState.

ChangeVMState would receive messages and figure out if to turn a VM on or off. The messages could be in a range of formats like:

  • turn on/off
  • power on/off
  • shutdown/start up the vm

They would resolve to the ChangeVMState intent. All messages sent to ChangeVMState was then forwarded to my webhook. I deployed the webhook as a function in Azure.

The code to execute the functions is pretty straightforward. One function receives the request and queues it on an Azure Storage Queue.  Azure functions provides a really simple infrastructure for doing just that. 

I mean, this is the whole method: 

The item being put on the queue – the desired VM state – is just a variable being set. 

Another function in Azure will then take up the values in the queue and will start or stop the VM based on state. Again, a pretty simple bit of code. 

I’m using the Azure Fluent Management SDK to start/stop a VM

So, finally, after the VM is put into the desired state, an email is sent either saying the VM is off or that it’s on and an RDP file is included. Ideally, I wanted to have the Google Assistant I was using notify me when the VM got up and running, but I just couldn’t get push notifications working – which is why I ended up with email. 

Thus,  I ended up with a Google Action, that I eventually called VILMA Agent (at first, I was calling it Shelly-Ann).  I could say to my Google Mini, “OK, Google, tell VILMA Agent, turn on” and I’d get an email with an RDP file.

The code for the functions part of VILMA is up here on GitHub

Advertisements

Cloud Technologies

Recently worked with Dr. Patrick Hosein to help deliver the University of the West Indies’ first ever Cloud Technologies course – it’s part of their MSc in Computer Science programme.

It was a challenging engagement that allowed us to help the students navigate how to get started with the Cloud. We had a good spread of concerns in the class, too. Students were software developers, involved in management and service delivery of IT services, researchers and lecturers.

We basically started with a definition – the NIST definition – of what Cloud computing is and built on that with examples, assignments, case studies and projects.

The NIST definition of a cloud service is:

Cloud computing is a model for enabling ubiquitous, convenient, on-demand network access to a shared
pool of configurable computing resources (e.g., networks, servers, storage, applications, and services) that
can be rapidly provisioned and released with minimal management effort or service provider interaction.
This cloud model is composed of five essential characteristics, three service models, and four deployment
models.

At the end of the course, the students needed to build projects that demonstrated their understanding of what a Cloud Service is.  We saw projects that featured:

  • Employee Task Tracking
  • Academic Course Management
  • Transport Ticketing Service
  • Vehicle Tracking Service
  • Health Data Management

All developed as Cloud Services. Most were challenged around the metering aspects and ideas that leveraged services other than exclusively web-based technologies were at a minimum.  However, they seemed to get that a implementing a Cloud Service has a number of considerations that go beyond just making software execute a core task remotely.

Most of the students utilized Microsoft Azure, as this was the primary platform we used for the course.  Azure was a good fit for us as they made it very easy for students to get on and interact with the platform – via Microsoft’s Azure Academic Pass. This pass gave students access to almost all of Azure – Storage, SQL, Machine Learning & Hadoop.  And any issues were sorted with a short email exchange.

Thus, as a first course, there are things we will have to improve on, but it definitely was a good experience and I’ll look out for more of those in the future.