AWS IoT provides secure, bi-directional communication between Internet-connected things (such as sensors, actuators, embedded devices, or smart appliances) and the AWS cloud. This enables you to collect telemetry data from multiple devices and store and analyze the data. You can also create applications that enable your users to control these devices from their phones or tablets.
In this tutorial you will see how to connect things to AWS IOT, create rules, and receive data in your email and phone.
Connect ThingsLog in amazon web services platform and go to Internet of Things session. In there choose AWS IOT and click on it.
In AWS IOT dashboard click connect in this left tab, and configure device (GET STARTED).
Next click on Linux and Python, download the files and put it in a folder.
Go to this directory in command line and type:
$ chmod +x start.sh
$ ./start.sh
This will install all Python libraries in your board and run basicPubSub
example to test communication. If all goes well your board is connected to AWS IOT.
Click on Rules and create, put a name that you want to the rule, and a short description.
In SQL version, you can choose 2015-10-08 option. In attribute put *
to get the entire message, and in Topic type sdk/test/Python
, to follow the example. Condition keep blank.
Lets add an action now, click on add action and choose SNS and configure the action.
Create a new SNS resource, click on Create a new resource button. Create a new Topic, give it a name and a short description, now click on the topic and choose subscribe to topic.
Next, in Protocol option, choose email and put your email on it.
Now in role create a new role and allow it to get permission to send a message to the selected resource, click on Update Role button.
Click on Add action button.
Now you are able to run the code and see the message coming from the board in your email. Get the command to run the python example code in the last line of the start.sh.
If you don't want to receive a lot of email of an example code, delete the while True: and run the code a once. The message coming from the mqtt
topic sdk/test/Python
is sent to your email.
Now connect sensors and actuators to your board, create new rules, send notifications and create new projects!
Best Regards!
Comments