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.

asked 7 months ago56 views
1 Answer
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

answered 7 months ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions