AWS Greengrass
AWS IoT Greengrass is software that extends cloud capabilities to local devices. This enables devices to collect and analyze data closer to the source of information, react autonomously to local events, and communicate securely with each other on local networks. AWS IoT Greengrass developers can use AWS Lambda functions and prebuilt connectors to create serverless applications that are deployed to devices for local execution. More details click here .
The following section explains how to install AWS greengrass in Catalyst 9000.
Step 1: Configure AWS IoT Greengrass on AWS IoT
Complete the AWS Greengrass setup required in AWS IoT Cloud as explained here
Notes: a. After complete step 1, select Greengrass group, "settings" section and update "Default Lambda function containerization" to "No container" option.
b. Download certificates/key/config from AWS console associated to Greengrass group and root CA certificate from recommended ATS (Amazon Trust Services) location.
Step 2: Create and package Lambda function
Create and deploy a Lambda function on AWS IoT Greengrass core, follow instructions here
Step 3: Configure the Lambda function
Follow this link to configure Lambda function.
Note: a. On the "Group Specific Lambda Configuration", select "No Container (always)" on Containerization option and select "Make this function long-lived and keep it running indefinitely" on Lambda Lifecycle
Step 4: Deploy on Catalyst 9000
a. Copy Docker image usbflash1
b. Configure Greengrass Application
app-hosting appid Greengrass
app-vnic managment guest-inerface 0
guest-ipaddress 10.195.184.1 netmask 255.255.255.0
app-default-gateway 10.195.184.1 guest-interface 0
app-resource docker
runopts "entrypoint /greengrassentrypoint.sh v $(APP_DATA)/certs:/greengrass/certs $(APP_DATA)/config:/greengrass/config"
app-resource package-profile custom
app-resource profile custom
cpu 5000
memory 1000
c. Install the greengrass Docker image and activate it
app-hosting install appid Greengrass pacakge usbflash1:aws_gg.tar
app-hosting activate appid Greengrass
d. If Catalyst 9000 is in corporate network behind firewall, update config.json file downloaded from AWS console with appropriate HTTP proxy details. If Catalyst 9000 is connected network with accessibility to AWS Cloud, then skip this step.
Here is sample config.json file:
{
"coreThing" : {
"caPath" : "root.ca.pem",
"certPath" : "653c7192eb.cert.pem",
"keyPath" : "653c7192eb.private.key",
"thingArn" : "arn:aws:iot:uswest2:591120533562:thing/ gg_apr3_2019_Core", "iotHost" :
"a3251ha57e0fzgats.iot.uswest2.amazonaws.com", "iotMqttPort" : 443,
"iotHttpPort" : 443,
"ggHttpPort" : 443,
"ggHost" : "greengrassats.iot.uswest2.amazonaws.com",
"keepAlive" : 600,
"networkProxy": {
"noProxyAddresses" : "localhost,127.0.0.1,198.18.134.1,.cisco.com", "proxy" : {
"url" : "http://proxywsa.esl.cisco.com:80" }
}
} ....
}
e. Copy certs and config to Greengrass container Using app-hosting data command copy root CA, Keys and Cerificate to container.
For example:
app-hosting data appid greengrass copy usbflash1:653c7192eb.private.key certs/653c7192eb.private.key
f. Start Application hosting container
app-hosting start appid greengrass
Step 5: Deploy subscription
In AWS IoT console, in Cloud > Select Greengrass group which is used to obtain certs/keys > Select subscriptions section and Deploy subscription.
Step 6: Test
In AWS IoT dashboard, select "Test" and subscribe to a topic "hello/world". Now you should see the messages sent from hello world lambda running on Catalyst 9000 to AWS IoT cloud on topic hello/world.