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년 전353회 조회
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년 전

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인

관련 콘텐츠