Welcome everyone. In this video we'll be going over
AWS Greengrass and just telling you what it is,
and a quick demo of what we're going to do.
So, just an overview again.
We're going to talk about AWS Greengrass,
do a description of the demo that we're going to do and then actually execute that demo.
So yeah. So what is AWS Greengrass?
Basically, in my description of best description,
it's basically a local AWS.
So, you know how normally you would have your devices all connected to AWS,
they need an internet connection,
and they all talk to the AWS server?
So in this, instead of the server being way out there connected to the massive Internet,
like let's say in Oregon and I'm in California and I have to connect to that server,
we can have that server run locally on our own network and do some functions there.
So basically, it doesn't have
all the same functionality as full AWS connected to the Internet,
but you could have some of the important ones for IoT such as ability to use AWS Lambda,
AWS IoT and other services offline.
And how it does this is it runs a Greengrass core device which could be any computer
that you have such as my laptop or a big server or even a dragon board can run AWS core?
And what, what this means is that it'll act as that server,
that we used before on AWS.
It will do the process the lambda functions and be the message broker between devices.
So, for example, we can have two devices there,
you can see Greengrass device 1 and Greengrass device 2.
They can each send messages to the message broker and the message broker will
send the messages back out to the corresponding topics or whoever's listening to what.
And this is nicer in the fact that you don't always need internet connection,
but there is a caveat in the sense that,
you do have to initialize the core and the devices at least once to the internet,
so that AWS knows about it and knows how to assign it.
So yes, will be going over a description of what we are going to do in the demo.
And here is the three parts of our demo.
We have, the Greengrass Core which will run on my laptop,
which will be the center point of all that processing,
and then we get the Greengrass Publisher,
which will be running also on my laptop.
That mean these can be running just programs that we run,
so they can have multiple running on the same machine.
And the third part is a Greengrass Subscriber,
which will be our Dragon board,
and I'll also be running a Greengrass device,
SDK and program to listen on a certain topic.
So what the laptop will be doing again is acting as a message broker,
and publisher will just send a simple message to the subscriber on a specific topic,
and then the subscriber when it hears that message,
it will blink an LED showing that it received a message.
So we are just going over to the simple demo on their computer and get everything set up.
So here we are on my computer,
and we can see that we have Greengrass Groups.
This is the group that we'll be using.
We called it fristGroup because we don't want to call it first group.
So we'll just go to the terminal so that we can run everything.
So, this computer is running Ubuntu 16.04.
We like it a lot just because it's a great development environment,
it's Linux on your computer and it's a nicer interface.
If you have Linux or your own type of OS you can also run it different ways,
but we'll be using Ubuntu for this one.
So first, the thing that we need to do on this is start up the Greengrass Core,
and we can do that by running
sudo./greengrassD start and this command
and other instruction will be provided in the readings.
But just a note, we have to run this in the,
in the specific directory because this is where the executable is.
Greengrass, greengrassD right there.
So, we are just going to run it.
It's taken six a bit to wait,
and here we go,
stopped letting greengrass, updating and starting the greengrass demo.
The next part is, we want to run
our publisher which will be just spitting out Hello World messages.
But before we do that, we have our directory here in that has all the files we need.
So these are the certificates and the private and
the public keys for the secure connections between the device and the IoT core,
or the Greengrass core.
So here it is for one device,
and here it is for the other device.
And these are the two programs we're going to running,
publisher.py and sub.py, which is
subscriber and our computer will be the publisher for this one.
So it's to python publisher.
Now there's a bunch of messages going on here,
but the main thing you want to care about is this.
So it just says publics, publish topic,
hello world, on this topic hello world.
And then, this is the message that publishes all this,
hello world sent from hello world publisher
and what number on the sequence that is publishing.
So yes, let's jump to the dragonboard to run its own greengrass device.
So here we are in the dragonboard,
and let's just LS to see all the files,
and you can see all the files there.
The same permission task that we had on my laptop also.
So the main program that we're going to run is sub.py.
But note here, don't run it just with python,
you want to run it with sudo,
considering we're using a GPIO pin, and that requires sudo.
So it is running sudo and then you can see here,
we're getting the messages from the broker,
from not the broker but from the publisher here at 289290.
And then, let's jump to my computer to see a similar number on my computer.
That's about 309.
It's a bit delayed considering the switch and stuff,
and that your, the screen wasn't scrolling.
But let's go back to the dragonboard and let's show that,
so the initial thing that we're doing on this dragonboard is switching LED,
so interacting with the sensor.
So we can see that LED blinking on and off and then I'm going to
stop running the program and you're going to see the LED not blinking.
So yes, the LED is not blinking and it is because it's not
listening anymore but let's run this again and show the LED blinking.
That's blinking and then I'm going to go on my computer,
and I'm going to stop the publisher there
just so you see that there is a connection between the two.
So it's stopping their.
And there, you can see it's not running.
It's not getting a message anymore but still listening.
Because it's not getting the message it's not blinking the LED.
Now this is all just a basic IoT,
how to activate a sensor from like a distance or through a connection.
But, the important part about this process is that,
it's all run locally,
so that even if you do get a disconnect from AWS you can still use,
as long as you're all connected to the same Wi-Fi network or
just the same internet network,
you can still talk to each other without having to worry about an internet connection.
So that's the benefit of doing AWS Greengrass.