Internet of Things (IoT) is being integrated in almost every device nowadays and it will have a strong impact in the future life, from waking up in the morning to sleeping in the night. There are many hardware and software platforms available to easily build any IoT based Application. We have covered many Iot hardware platforms in previous tutorial like ESP32, Raspberry Pi, ESP8266 etc. to build simple LED projects to complex applications. We also covered Software platform for IoT like Adafruit, IFTTT, Blynk App, Artik cloud, Google Firebase etc. Today we will explore one more popular IoT cloud platform provided by Amazon called AWS (Amazon Web Services).
AWS IOT Service stands for Amazon Web Service Internet of Things. This service allows us to connect our devices to the internet to exchange data securely, process it and act upon it. Along with AWS IOT the Amazon Web Services also provides tons of other features like virtual machine deployment, web-hosting, etc.
Creating Amazon AWS User Account
To access AWS IoT Services you need to create an account, for this browse to https://aws.amazon.com/.
Here, click on complete sign up at right top corner, as shown in the image below.
It will redirect you to the sign up procedure. There, amazon will ask you to provide your Debit/Credit card details. You can use this service for free for 12 month duration so just enter your card details since you will not charged for 12 months, but make sure to de-activate the account before 12 months if you are not using the account any longer, otherwise it will charge you.
Now click on continue and choose Basic plan.
Creating AWS thing with Certificate and policy
Step 1:- After creating account, search for “iot core” under AWS service, click on it to open the console.
Step 2:- Now, a dialog box will appear; just click on “get started”, as shown below.
Step 3:- The main page of AWS IoT will open, where you will find some documents for getting started with AWS IoT.
Now, on the left side Click on the “Manage” option.
Step 4:- Now, register a thing to proceed. A thing is a device which can connect to the internet, so we will create a thing on this console through which our device can communicate.
Click on “Register a thing” button, as shown in the below-mentioned image:
Step 5:- It on you that how much things you needed. As you can create multiple things or even a single. For getting started with AWS IoT we are creating a single things, so click on “create a single thing”.
Step 6:- Name your thing, like I am giving myespwork. After naming, scroll down and click on next.
Step 7:- Now click on “Create Certificate”.
Step 8:- Now, AWS will provide the keys for the thing you created earlier. You can access this thing through these keys only. First, click on Activate button and download the three key files and save it on your PC.
The three files shown in above figure should be downloaded in a folder on you system.
Note: For some users the CA file downloaded in some other format, it might open as a stream of code. So, to get rid of this problem, just right click on the code and save as it in ‘.pem’ extension file.
Step 9:- After creating the certificate we need to create a policy for the thing. For this click on “Attach a policy”.
Step 10:- At this time there will be no policies in your account, since you haven’t created one, so for now click on “Register Thing”.
Step 11:- Now, a window will open, here you can create policy by clicking on “secure” and then “policies” in the left side menu.
Step 12:- Now click on “Create a policy”.
Step 13:- Here, name your policy according to you. And, in the action box type iot:* and in Resources ARN type *. Allow button should also be checked in it. Finally press the “Create” button on the end of the page to create a policy.
Step 14:- Now, a window will open, here click on ‘secure’ and then ‘certificates’. Therefore, you have policy now, attach it by clicking on ‘certificates’ and then ‘Attach policy’.
Step 15:- Now, select the name of the policy you have created and then click on “Attach” button.
We have successfully created and attached a certificate and a policy with the thing. Now we can check if the thing is working by using the “test” option in the AWS IOT console. But before this we will need Broker address of our thing.
Getting AWS Thing details
To get the details like broker address, update link and etc of your thing, click on ‘manage’ option and then on ‘name of the things’.
Now, a window will appear, in this navigate to “interact” and you will be provided all the links to access your things. Take the HTTPS link from here for the testing of your thing.
Testing the Thing
1. Go to the main screen and click on the “Test” option in left hand side, to the our thing.
2. Now, in the test option you will see two more sub-options, which are Subscribe to a topic and Publish to a topic. First, you have to subscribe to your thing by entering the name of it.
3. Now click on Publish to topic and you should see a message in your thing as shown below:
Hence, you have successfully completed the getting started tutorial of AWS IoT. You can also use AWS IoT for sending email using ESP8266. Stay tuned with us for more amazing AWS based IoT projects.