How to connect edge devices to AWS Greengrass core device running version 2 - aws-iot

In AWS Greengrass v2 developer guide, Move from AWS IoT Greengrass Version 1, it says, AWS IoT Greengrass V2 currently doesn't support connected devices, also called Greengrass devices.
Wonder what would be the recommended ways (for the time being) to connect edge devices, such as ESP devices, to the Greengrass core device running Greengrass version 2.

Found on AWS IoT forum an explanation from Farad at AWS in Feb 2021:
Greengrass V2 unfortunately does not provide GGAD (Greengrass Aware Device) yet. They are actively working on addressing this gap and hope to release it in the coming months. Until that time, you can use Greengrass version 1 or you could use this example MQTT Bridge code for Greengrass V2 as a skeleton for implementing your own MQTT broker on V2 in order to support remote devices.

Related

AWS DUPLICATE_CLIENT_ID

I have a Jetson, set up as core device. It has greengrass installed on it (inc. deployments, components etc)
I want to set up an AWS SSH tunnel, installed and configured the aws-iot-device-client, but it gets disconnected. In the AWS console at MQTT Test I get the error message DUPLICATE_CLIENT_ID.
Any thoughts or ideas are highly appreciated.
If you are using AWS IoT Greengrass V2, you can deploy the AWS-provided Secure Tunneling component to install and configure the AWS IoT Device Client for you, so you can create SSH tunnels. This component uses the Greengrass nucleus' MQTT connections, so it avoids the duplicate ID error.

Difference between AWS IoT Device SDKs and AWS IoT Device Client

I am learning the way to use AWS and searching to understand the Difference between AWS IoT Device SDKs and AWS IoT Device Client.
Finally, I want to use Raspberry Pi for Telemetry, but which set of tools should I use AWS IoT Device SDKs OR AWS IoT Device Client.
Since you are working with Raspberry Pi, I would recommend you to use AWS IOT Device sdk. Specifically AWS IOT Device SDK for Python or Nodejs. Further using AWS IOT Device SDK :
Register Thing in AWS IOT Console
Register Certificates and Download them
Copy over Certificates to Raspberry PI
Use Sample Application provided in AWS IOT SDK GitHub and connect to AWS IOT and start publishing messages.
Here is the helpful repo to get you started : https://github.com/aws/aws-iot-device-sdk-python
AWS IoT Device Client looks like a complete software running on Linux (according to AWS description). AWS IoT Device SDKs on the other hand are libraries that allows you to connect your devices to AWS-IOT through mqtt and websockets protocol.
I personally would go with the classic SDKs approach for the reason that not enough information other than AWS Docs are available for Device Client so far
You can use the IoT Device client to embed within the Firmware of a Device however AWS IOT SDK is more of a library for accessing AWS resources programmatically.

How to use AWS IoT rule engine locally at AWS IoT greengrass?

Is there a way to use AWS IoT rule engine locally at AWS IoT greengrass?
Is the rule engine a feature of AWS IoT core (cloud) only?
Is a lambda function deployed to the local AWS IoT greengrass that subscribes to a topic and takes an action an equivalent of the AWS IoT core rules engine?
Even though greengrass is an extension of IoT Core, there is no native rules engine component in the greengrass service, greengrass serves the purpose of eventually sending the data to IoT Core where you can use rules engine to trigger other cloud services.
If you're specifically looking into Lambdas which run on greengrass, these Lambdas are running on your hardware and not the cloud and hence need to be handled by you, either using subscriptions or active invocations (code invoke).
This is because when you create a deployment from the cloud, greengrass service will containerize the greengrass group that you configure and deploy it on the GG core device. Once the container reaches the Core device, it cannot be altered/managed from the cloud unless you make another deployment with modifications.
Also there are 2 types of lambdas, long lived (think of it as daemon processes) and on-demand (think of it as a code which has to be triggered manually) lambda. The only way to trigger an on demand lambda is either subscriptions or active invocation. There’s no native feature which triggers on-demand lambdas, it has to be in your code logic.

Can greengrass be run in my data center

We have a requirement where we want to run AWS GreenGrass on our VM in our own data center which will not have connectivity with AWS IoT. Thought is to have similar cloud and on-premise solution(behind a firewall). We want to reuse the cloud solution, which has lambda functions in AWS GreenGrass. Wanted to know if it is possible to run AWS GreenGrass without AWS IoT? Any insight would be of great help.
You should consider the hardware requirements of Greengrass and you can find more information here.
For defining the Greengrass configuration for first time, you need to connect your Greengrass to AWS IoT by deploying, after that you can run Greengrass without any AWS IoT connectivity. But Consider that the deployment of serverless functions (Lambda functions) will be done through AWS IoT. You can find more information about Greengrass here.

how to register device to azure iot hub from device(with iot client c sdk)

I couldn't connect my iot device to azure iot hub to register device.
I saw some example in node.js and c# sharp client sdk. But I couldn't find for c sdk. Is it possible register device (obtain credential) from client side?
How can I connect my device to iot hub?
I tried to use this code:
https://github.com/Azure/azure-iot-sdk-c/blob/master/iothub_client/samples/iothub_client_sample_mqtt/iothub_client_sample_mqtt.c
Also I used this article for help: https://learn.microsoft.com/en-us/azure/iot-hub/iot-hub-device-sdk-c-intro
Very important: you don't want a device to create a new identity on its own in IoT Hub as that would mean that the device has credentials to manage the IoT Hub instance. This is a considerable security risk.
This is one of the main reason why we have 2 types of SDKs: service client SDKs and device client SDKs.
The service client SDKs are meant to be used in back-end applications that will manage the Hub, while the device client SDKs are meant to be used on devices. This allows to keep control of your IoT solution and prevent a rogue compromised device to start messing around with the other devices or your data.
You can actually find a C service client SDK in the C SDK repo under the folder "service" if you want to develop a back-end or management application in C.
Now, all that said, what it seems you are actually looking for is for a secure auto-registration mechanism, which is something we don't have yet on Azure IoT Hub. You can actually vote this feature up on uservoice here, as we are using this to help prioritize the upcoming features of the service.

Resources