Section two, connecting things to AWS IoT Core. In this section, we will learn the following this string of thing, creating and attaching policies, connecting a Raspberry Pi to AWS IoT, connecting the ESP 32 thing to AWS IoT, the first steps, connecting ESP 32 thing to AWS IoT, video 2.1 this string, I think, in this video, we will learn the following. Why should we register things? How can you register anything? What is the certificate, importance of the certificates? Why should we register things in AWS IoT, we have a registry that keeps a record of all the devices that are registered to your AWS account.
It also states stores the metadata such as the thing that tributes and capabilities for free. For example, these attributes describe whether the distance measured by an ultrasonic sensor is in meters or centimeters. How do we register anything? In this video, we will register a Raspberry Pi to AWS IoT Core. To register your thing, sign into your AWS account. Make sure that you choose a single region throughout your project.
If you don't use the same region for all the services in your project, then you might face an issue while sending data from one service to another. I am choosing US East North Virginia here. This region has permissions to almost all the services in AWS I recommend you to choose the same region. Go to the Internet of Things Then IoT code on the left hand side in the navigation pane, select Manage, then choose this sort of thing. Now, it will direct you to creating AWS IoT things. Here.
As we are registering a single Raspberry Pi, choose Create a single thing. Then you can add your device to the registry here. In the Name field, enter a name to your IoT thing. In this video, as we are registering a Raspberry Pi, I am giving my thing name as my archive. For now, we should not add a type or group for our thing. Here, we can add attributes like distance centimeters, then next, adding a certificate for your thing, weight.
But why should I add a certificate and what actually a certificate is? guess you're right. Each device must have a credential for connecting to AWS IoT code. Adding a certificate enables secure communication between your device and AWS IoT. Primarily, these certificates are issued by a trusted entity called a Certification Authority. In short, see, the AWS IoT can generate a certificate for you, or you can use your own certificate.
In this video, AWS IoT will generate a certificate for us. Are you excited to create one come? Let's go. Here. We will choose one click certificate creation. But if you choose to create your own certificates, then you can select this or this now, create certificates.
Yes, you created this certificate. Now download certificate For this thing, private key root ca for AWS IoT, this root ca certificate will not directly get downloaded like previous two certificates. Instead, it directs you to this page. Now select Amazon root ca one, this opens and then webpage like this, copy the entire text and paste it into a file. Here, I have already created one file with the name, Amazon underscore root underscore c underscore one dot p m, save it and come back to the main page. Now as all the certificates have been downloaded, select activate successfully activated this certificate.
But did you get a doubt like me that why should we download a root ca and a private key along with the thing certificate? Let's see there isn't the root ca Self signed certificate. The Certification Authority typically exists within a hierarchical structure that contains multiple other CEOs with the kind of tree structured, the CA at the top of the hierarchy is referred to as the root ca. And this root ca can certify the other branch or subordinate CES. So we will be downloading a root ca on to our device. In AWS IoT, the data is encrypted during the data transfer and decrypted after the data transfer is completed.
Keys are used during the encryption and decryption process. If the data is encrypted with the public key, then it can be decrypted only with the corresponding private key. Generally, the public key is available to anyone, whereas a private key is kept secret. Remember, the three certificates must be downloaded immediately after the session. difficut creation. Once if you go to the next step, the private key cannot be downloaded again.
The root ca certificate must have dot p m extension only. So, create a file with dot p m extension. Next, attach a policy, then add a policy for your thing. Since we have not created any policies beforehand, we will create a new policy and attach it in the next video. For now, registered thing, we have successfully registered our first thing, my RP in the AWS account. In this video, we covered the following.
Why should we register things? How can you register your thing? What is the certificate and importance of the certificates. In the next video, we will learn creating and attaching policies. See you in the next video.