AWS IoT DynamoDB Create Rule - amazon-web-services

I am trying to setup a AWS IoT rule to send the IoT incoming data into the DynamoDB, I think everything has been setup correctly such as the policies.
What I do not understand is what information is needed in the rule, to send the incoming data to the database?

You need to enter the mqtt topic name in your iot query
select * from topic_name;
Also here is the short guide about how you can get data from AWS iot to dynamo db for quick reference
Iot Rule to insert data into dynamo db

Related

How to receive data MQTT on AWS

I have an external service that sends me data via MQTT. I need to receive this data on AWS then process it and then write it to an RDS instance. What services are recommended for this purpose? An Amazon MQ and a Lambda? A SQS and a Lambda? Any other?
Thanks for any help.
AWS IoT 'things' have a Message Broker that supports MQTT.
Traditionally, IoT and MQTT involves huge numbers of messages, which are normally stored in DynamoDB. However, you could write an AWS Lambda function to store the received messages in an Amazon RDS database.

Integration of IOT topics to AWS dynamoDB isn't working at all

I have an Rpi from where I am publishing to an MQTT topic on AWS IOT.
Then I created a rule to publish that particular payload into the Amazon DynamoDB.
I managed to send data on IOT topic but I am facing problem in populating it in DB.
I followed this document https://docs.aws.amazon.com/iot/latest/developerguide/iot-ddb-rule.html by AWS, instead of IOT button I used Rpi and MQTT topic but I couldn't see any entry in DB. Their is no permission issue, I am the root user I have all the permissions.
Can anyone help me out why I am seeing that behaviour and how I can see the payload in table.

AWS IoT rule which will invoke, whenever we will publish (or perform any IoT action) irrespective of the topic names

I am testing AWS IoT rule to republish for the IoT topic with an AWS IOT rule actions. My mqtt clients are publishing in different topics: device A publish data into topicA, device B publish data into topicsB.
So in AWS IoT console, I defined a SQL rule selecting all devices coming from the topic as '#'. In this case, I'm not able to invoke rule if
one of mttq client is publishing for the topic 'topicA' or 'topicB'.
I have written my rule by following these steps:
1.My query string is
SELECT * FROM '#'
2.My action is Republish messages to an AWS IoT topic. This action will republish the message to another AWS IoT topic given below:
topicsC
What is the right way to invoke a rule which is in my case if someone published for any topic?
You can't create a republish rule where the input topic filter includes the output topic. e.g. if you can't have SELECT * FROM # and publish to a topic called topicsC because topicsC is included in #. If you could the rule would invoke itself.
You should add a / to create a namespace in your topics.
You could have devices A and B publish to device/A and device/B respectively. Then you can have a republish rule SELECT * FROM 'device/# which republishes to a different topic, alldata.

How to store timestamp message from aws iot button to DynamoDB

I am sending message from my AWS iot button and storing it to the DynamoDB. My partition key is "SerialNumber" and the sort key is "ClickType". The message is stored according to the key. But it is overwriting the previous data if there is already same ClickType. I do not want to overwrite my previous data and also want to see the time of the sending message. Can somebody provide me any suggestion or any link about how to do it?
On your AWS IoT rule for getting the message to lambda has the timestamp when the message was captured by Aws Iot rules engine. You could catch that on your rule and store on your Dynamodb table.
To do that, you have to use the timestamp() function from AWs IoT

Is it possible to call API on EC2 from AWS IoT Rules Engine?

I have use case like once data received in AWS IoT Rules Engine from things, I want to call API instead of dynamoDb, kinesis and lambda. I read FAQ https://aws.amazon.com/iot/faqs/ and doc but now found anything related to routing data to API on EC2 instance. This developer guide http://docs.aws.amazon.com/iot/latest/developerguide/iot-create-rule.html shows how to route data to dynamoDb, S2, Kinesis, SNS and machine learning. Is it possible to route data to EC2 instance from IoT Rules Engine?
You can create a iot rule to connect to lambda and in lambda function you can call your EC2 API.