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年前366ビュー
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年前

ログインしていません。 ログイン 回答を投稿する。

優れた回答とは、質問に明確に答え、建設的なフィードバックを提供し、質問者の専門分野におけるスキルの向上を促すものです。

質問に答えるためのガイドライン

関連するコンテンツ