How to implement authentication in AWs IoT Greengrass Component deployed to the Greengrass Core Device?

0

Hello,

I have developed a Greengrass Java component which I have deployed to a Greengrass Core device. This component is built with the AWS IoT Java SDK and it makes communication between the device shadow of the Greengrass Core device and the Greengrass Core device itself. All communication is via MQTT.

This component also enables a mobile app sending desired state to the device shadow which is received in the Greengrass Core device.

At the moment, I authenticate the component's use of the AWS IoT Java SDK by just using the access key and the secret key like this:

this.awsClient = new AWSIotMqttClient(clientEndpoint, id, "access_key", "secret_key");

Now, I am aware this is not a best practise and I need to change that and here is my question. I did check the AWS documentation but it seems a bit overwhelming to me regarding authentication in my specific case so I wonder if you can help me out and direct me in what approach I should use here?

Thank you in advance.

已提問 2 年前檢視次數 360 次
1 個回答
1

Hi,

Greengrass provides AWS credentials to components and the SDK will pick these up automatically. All you need to do is update your component recipe and add a dependency on aws.greengrass.TokenExchangeService.

https://docs.aws.amazon.com/greengrass/v2/developerguide/interact-with-aws-services.html

Thanks, -joe

AWS
已回答 2 年前

您尚未登入。 登入 去張貼答案。

一個好的回答可以清楚地回答問題並提供建設性的意見回饋,同時有助於提問者的專業成長。

回答問題指南