What's Greengrass?
- AWS Greengrass makes it possible for customers to use Lambda functions to build IoT devices and application logic.
- Specifically, AWS Greengrass provides cloud-based management of applications that can be deployed for local execution.
- Locally deployed Lambda functions are triggered by local events, messages from the cloud, or other sources.
AWS Greengrass consists of
- Software distributions
- AWS Greengrass core software
- AWS Greengrass core SDK
- Cloud service
- Features
- Lambda runtime
- Thing shadows implementation
- Message manager
- Group management
- Discovery service
Install
- File description
- greengrass-platform-version.tar.gz - this compressed file contains the AWS Greengrass core software that runs on the AWS Greengrass core device.
- GUID-setup.tar.gz - this compressed file contains security certificates enabling secure communications with the AWS IoT cloud and config.json which contains configuration information specific to your AWS Greengrass core and the AWS IoT endpoint.
- Source tarball
- sudo tar -xzvf greengrass-platform-version.tar.gz -C /
- sudo tar -xzvf GUID-setup.tar.gz -C /greengrass
- Certification
- Running
- cd /greengrass/ggc/packages/x.x.x/
- sudo ./greengrassd start
pi@raspberrypi:/greengrass/ggc/packages/1.3.0 $ sudo ./greengrassd start
Setting up greengrass daemon
Validating hardlink/softlink protection
Validating execution environment
Found cgroup subsystem: cpu
Found cgroup subsystem: cpuacct
Found cgroup subsystem: blkio
Found cgroup subsystem: memory
Found cgroup subsystem: devices
Found cgroup subsystem: freezer
Found cgroup subsystem: net_cls
Starting greengrass daemon
Greengrass successfully started with PID: 1600
pi@raspberrypi:/greengrass/ggc/packages/1.3.0 $
Deployment
- Create Lambda function
- Subscription
- Deploy
- test
Interacting with Devices in an AWS Greengrass Group
- Testing Communication
- python basicDiscovery.py --endpoint a1q79ntmqqqssy.iot.us-east-1.amazonaws.com --rootCA root-ca-cert.pem --cert e66d29a1b4.cert.pem --key e66d29a1b4.private.key --thingName HelloWorld_Publisher --topic 'hello/world/pubsub' --mode publish --message 'Hello, Tommy! Sent from HelloWorld_Publisher'
- python basicDiscovery.py --endpoint a1q79ntmqqqssy.iot.us-east-1.amazonaws.com --rootCA root-ca-cert.pem --cert f010b25d92.cert.pem --key f010b25d92.private.key --thingName HelloWorld_Subscriber --topic 'hello/world/pubsub' --mode subscribe
- resulting in scbscriber
- 2018-03-11 21:02:21,164 - AWSIoTPythonSDK.core.protocol.internal.workers - DEBUG - Produced [message] event
- 2018-03-11 21:02:21,164 - AWSIoTPythonSDK.core.protocol.internal.workers - DEBUG - Dispatching [message] event
- 2018-03-11 21:02:21,164 - AWSIoTPythonSDK.core.protocol.internal.clients - DEBUG - Invoking custom event callback...
- Received message on topic hello/world/pubsub: {"message": "Hello, Tommy! Sent from HelloWorld_Publisher", "sequence": 177}
Interacting with Device Shadows