出自flip the world 檢視Application - Greengrass的原始碼 頁面討論 閱讀檢視原始碼檢視歷史 ←Application - Greengrass 您沒有權限執行編輯此頁面,由於以下原因: 您請求的操作只有這個群組的使用者能使用:使用者 您可以檢視並複製此頁面的原始碼。 '''AWS Greengrass''' runs Lambda functions locally on IoT devices. These notes cover installing it, deploying to a group, and talking to device shadows. [[File:Greengrass.png|Greengrass]] == 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 ** AWS Greengrass API * 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 ** cd /greengrass/certs/ ** sudo wget -O root.ca.pem http://www.symantec.com/content/en/us/enterprise/verisign/roots/VeriSign-Class%203-Public-Primary-Certification-Authority-G5.pem * Running ** cd /greengrass/ggc/packages/x.x.x/ ** sudo ./greengrassd start <pre> 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 $ </pre> == Deployment == * Create Lambda function * Subscription ** Source ** Target ** Topic * Deploy * test ** Publish == Interacting with Devices in an AWS Greengrass Group == [[File:Gg-get-started-065.5.png|Greengrass group communication]] * 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 == [[File:Gg-get-started-077.5.png|Interacting with Device Shadows]] [[Category:Projects]] 返回到「Application - Greengrass」。