Create AWS IoT Core Things using AWS SDK

AWS IoT Core is a highly scalable platform for IoT devices. I automated the creation of Certificates, Things, and Attaching policy using AWS SDK with the below steps.

Step 1:

I created an IAM user with programmatic access and attached the AWSIoTFullAccess policy.

Step 2:

We will need to create Security Policy that can be attached to Certificates created for every device.

I have made a policy so that, the device can only connect using its ThingName as clientId, can subscribe or publish to topics starting from its ThingName.

Step 3:

Code flow:

  • We create a certificate for the device using the createKeysAndCertificate method.
  • Attach policy to the certificate
  • Create AWS IoT Core Thing
  • Attach Certificate To Thing

Result:

The certificate which we just created is attached to Policy and Thing.

Output on the console:

Source Code: https://github.com/riddheshganatra/iotcore-createthings

Demo: https://www.loom.com/share/69b18339147742578bb82e635259b118

Share this with anybody you think would benefit from this. Have any suggestions? Feel free to message me on LinkedIn.

--

--

Software Architect, Full Stack Web developer, MEAN/MERN stack, Microservices, etc

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Riddhesh Ganatra

Software Architect, Full Stack Web developer, MEAN/MERN stack, Microservices, etc