Last week, I had the pleasure to attend our CTO Ambassadors conference, hosted by our Global Field CTO Chris Wolf. This was an excellent week, especially for someone like me who works directly for a single business unit at VMware. It gave me great insight into the activities going on in our other business units at VMware. One of the highlights for me was our “Serverless” night, where I finally got an opportunity to learn about Serverless, Functions As A Service (FaaS), AWS Lambda and all that other stuff that I kept hearing about, but did not quite fully understand. In particular, we focused on AWS Greengrass on vSphere. What is AWS Greengrass? Well, if we think of the Internet of Things (IoT) space, and especially IoT edge devices, AWS Greengrass is software that lets you run AWS Lambda functions on connected devices in a secure way. The bottom line is that you don’t want to be pulling all of the data from all the devices and sensors connected to the edge device back into the DC or even up into the cloud. AWS Greengrass is a way of processing that data while keeping it at the edge, and only returning the information you need.
Mark Peek and his team did a great job in putting together some lab exercises for us to help with our learning (along with the obligatory beer and pizza of course). To start out, we learnt about how to deploy AWS Greengrass on vSphere. The next step was to create some simple Lambda functions that interact with AWS. Finally we tested these Lambda functions from AWS to interact our AWS Greengrass on vSphere implementation.
The following post relates my learning experience, and if you are interested in trying it for yourself, I’ve got a few pointers to get you started.
The first question comes back to why would we want to do something like this? To expand on what I said earlier, think of what is happening today in the world of IoT. When it comes to processing IoT sensor data, latency between your DC and edge, or even the sheer volume of data, might make it prohibitive to pull this data to a central location. Instead, processing the data at the edge may be a more logical approach. AWS Greengrass enables AWS services to run on vSphere, either in the data center or at the edge. Here is a description taken directly from the VMware AWS Greengrass Core landing page, which explains it far more succinctly than I ever could.
AWS Greengrass is software that lets you run local compute, messaging, data caching, sync, and machine learning inference capabilities on connected devices in a secure way. With AWS Greengrass, connected devices can run AWS Lambda functions, execute predictions based on machine learning models, keep device data in sync, and communicate with other devices securely – even when not connected to the Internet. By running Greengrass on-premises on vSphere, customers will be able to closely integrate Greengrass, using Lambda functions, with other applications and services already running on vSphere infrastructure at the edge. Placing cloud services in the same locations where devices reside and data is generated will give organizations even greater capabilities to innovate and build intelligent systems that surpass what’s possible in the cloud, data center, or edge alone.
Chris Wolf also provides an interesting write-up called Hybridity at the Edge, where he discusses a number of use cases.
There are a few things you will need to get started with AWS Greengrass on vSphere. First, you will need to download the AWS Greengrass Core on VMware vSphere VM Appliance. For the purposes of this training exercise, I simply downloaded it to VMware Fusion running on my Mac.
Once the appliance is deployed, verify that you can login as ggc/ggc. That is all we need to do for the moment. Shortly we will ‘connect’ with it.
The second thing you will need is an AWS account (free). Now, the exercises that we run through here are free (as there is something like 1,000,000 function calls that can be made on a free account) but if you decide to do other AWS stuff in your account, then of course, that other stuff may not be free.
Once these two steps are complete, you’re ready to go. Log into AWS with your free account, and you should see a list of AWS Services similar to the following. Note that not all regions supports Greengrass, but US-West/Oregon region does.
I’ve highlighted the three services that we will be using for our exercise, namely Lambda, AWS IoT and AWS Greengrass. The following are the steps to configure AWS Greengrass on AWS IoT and run some FaaS.
Set up your Greengrass group, get certificate, keys and json, start Greengrass
Follow the instructions documented here in Configuring AWS Greengrass on AWS IoT. It is quite straight forward. The important part is to create a Greengrass group and core, and download the core’s certificate, public and private keys, and config.json as a tar.gz. These will need to be transferred to your vSphere VM appliance deployed earlier. The steps on how to unpack the down and start Greengrass can be found on our GitHub repo here. You only need to follow steps 2-6 in the “Start Greengrass using the AWS UI” section. OK – that’s the appliance/AWS Greengrass core device all ready to go.
Write and package a simple Lambda function
The next steps are to configure and deploy an AWS Lambda function on your AWS Greengrass core device. To begin with, we will create and deploy a Lambda function on the AWS Greengrass core that sends “Hello World” messages to the AWS Greengrass cloud. Note that at this point, you will not be working on the VMware VM appliance. Instead, you will be downloading the Greengrass Core SDK (Software Developers Kit) to your laptop, and looking at some of the pre-written python examples. The steps to create and package your first Lambda function can be found here. By clicking through the steps, you will learn how to add your function to your Greengrass group created earlier through subscriptions, as well as how to deploy the Lambda function and subscription configurations onto your AWS Greengrass core before finally testing that it works.
Write and package a more complex Lambda function
In this section, you are guided through the creation of a more complex Lambda function. Now there will be two subscriptions, one going from the core to AWS IoT Cloud, and the other going in the opposite direction. One will trigger the other. The complete steps to create the Lambda function, and how to trigger it, are found here. The only thing here that I got confused on in this exercise was the fact that you needed to create two “topics”, “hello/world/counter” and “hello/world/counter/trigger”, which wasn’t immediately obviously from the screenshots in the exercise. Just to clarify, when everything is configured, the testing should look something like this (note both topic entries).
And that completes a first look at AWS Greengrass on vSphere. For me, it answered a lot of questions and I look forward to learning a lot more about this technology over the coming year.