0

I am trying to create the following architecture on AWS. AWS architecture

I have 3 devices connected to Iot core:

-Thermometer

-Air conditioner

-Lambda function

Thermometer should send the temperature every 5 seconds to the Core, then the telemetry is sent to Kinesis stream and to Kinesis Analytics.

Here is the query who groups data arriving in 60 sec windows.

Query :

CREATE OR REPLACE STREAM "TEMPSTREAM" ( 
   "avg_temp" BIGINT NOT NULL, 
   "dateTime" TIMESTAMP,
   "sender_id" VARCHAR(64));

CREATE OR REPLACE PUMP "SAMPLEPUMP" AS 
INSERT INTO "TEMPSTREAM" ("avg_temp","dateTime","
    SELECT STREAM AVG("temperature") as "avg_temp",ROWTIME,"sender"
    FROM "SOURCE_SQL_STREAM_001"
    GROUP BY "sender",STEP("SOURCE_SQL_STREAM_001".ROWTIME BY INTERVAL '60' SECOND)
    having AVG("temperature")>=27;

It produces the Average of the temperature then sends it to Lambda function.

This function just connects to IoT Core and sends a message on a topic. Air conditioner is subscribed to this same topic waiting for a message to turn on or off.

Problem

It's almost all working fine, the problem is that even if the query produces just one result a minute, Lambda function recives it more than once a minute as you can see from the screenshot below:

Problem screenshot

Lambda code is the same of the Kinesis Output Template

Community
  • 1
  • 1
  • How/where is your Lambda function configured? Is it transforming the data _within_ Kinesis, or is it receiving the _output_ of Kinesis? Also, could you please clarify your problem (what is happening + what you _expect_ should be happening). Feel free to Edit your question to add these details. – John Rotenstein Dec 28 '19 at 13:11
  • Your image shows Lambda invocations with unique request IDs, and all of them appear to complete successfully (they don't timeout and they don't appear to fail). If they were retries by Lambda, you should see a repeat of the original request ID. – jarmod Dec 28 '19 at 16:10

0 Answers0