You will now implement the AWS Lambda function to scan the records from the DynamoDB. We have assumed that the records have already been written to the table as demonstrated in this learning path on creating IoT applications with WoA and AWS IoT Core .
Go the AWS Lambda console. Then, create the function as shown below:
At this point your wizard should look as per the image below:
Next, in the Create function wizard expand Change default execution role, and proceed as follows:
This ensures that your AWS Lambda function has all the necessary permissions to access the items in the DynamoDB table.
Finally, scroll down and click the Create function button. This will take you to the GetAverageTemperature function dashboard:
In the next step, you will use this dashboard to modify the function code.