Connecting an IoT device to the AWS cloud

Brien Posey provides step-by-step instructions for installing an agent on a device so that AWS can detect and manage it.

The AWS IoT Portal can be used as an interface for the collective management of your IoT devices. Although you can use this portal to create an offline device inventory (an inventory without actual connection to a device), it is also possible to install an agent on a device so that AWS can detect and manage device (although not every IoT device supports agent installations). In this blog post, I will show you how.

To get started, select the IoT Device Manager option from the list of services (located in the Internet of Things section). When the AWS IoT keyboard opens, expand the Connect tab, and then click the Start sub-tab. This will cause AWS to display the screen shown in Figure 1with

Figure 1: Connecting an IoT device is a three-step process.
[Click on image for larger view.] Figure 1: Connecting an IoT device is a three-step process.

Registration of a device
As you can see in the figure above, connecting an IoT device is a three-step process. The first step in this process is to register a device. Click on the Start button. When you do this, you will be taken to a screen asking you how you are connecting to AWS IoT.

Figure 2: Select the platform and SDK that are compatible with the IoT device.
[Click on image for larger view.] Figure 2: Select the platform and SDK that are compatible with the IoT device.

You will need to select the operating system running on the device as well as the SDK you want to use to manage the device. For the purposes of this blog post, for example, I will be logging in to a Windows device using the Python SDK.

Click Next and you will be asked to “give the name of your item”. In AWS, a thing is defined as a digital representation of a physical IoT object. I have written a special blog post on AWS things management. In this case, however, you will simply need to enter a name that will help you identify the device.

Download the Connection SDK
Click Next and you will be taken to the screen shown in Figure 3With This screen lets you download the SDK connection needed to connect the device to AWS.

Figure 3: You will need to download the SDK in order to connect the device to AWS.
[Click on image for larger view.] Figure 3: You will need to download the SDK in order to connect the device to AWS.

Go ahead and download the SDK and open it. The content of the SDK varies based on the platform you have chosen. In the case of a Windows device, the SDK contains a PowerShell script, a PEM file (a certificate), a public key, and a private key.

Before moving on to the next step, you will need to download and install Git for Windows. You will also need to add C: Program Files Git bin AND C: Program Files Git cmd on the device path and then restart the device. While in it, you will also need to add the Python folder and the Python script (assuming the device is using Python) to the system path. These paths may vary, but in my system they are:

  • C: users AppData Local Programs Python Python39
  • C: users AppData Local Programs Python Python39 Scripts

Direction of Writing
The next step in the process is extracting the contents of the SDK and copying it to a folder on the IoT device. Click Next on the AWS keyboard and you will see instructions to help you with the process, as shown in Figure 4with

Figure 4: AWS gives instructions to help you along.
[Click on image for larger view.] Figure 4: AWS provides guidance to help you along.

You will then need to start the script included in the SDK. Again, the process varies by platform. In the case of a Windows device, you will need to open an elevated PowerShell session and then launch the Start.ps1 file. You can see how this works at Figure 5Note in the figure that I have temporarily disabled the execution policy so that the script can be executed.

Figure 5: Thus start the Start.ps1 script.
[Click on image for larger view.] Figure 5: Thus start the Start.ps1 script.

Click Done and you should see a message like the one shown on Figure 5 indicating that the device has been successfully connected. Likewise, you will see the IoT device listed inside the Things keyboard, as shown in Figure 6With You can click on the device to view additional details or to set the device in groups or to interact with the device in other ways.

Figure 6: The IoT device is connected to AWS.
[Click on image for larger view.] Figure 6: The IoT device is connected to AWS.
Figure 7: The Windows IoT device is listed on the Things tab.
[Click on image for larger view.] Figure 7: The Windows IoT device is listed on the Things tab.

About the Author

Brien Posey is 20 times Microsoft MVP with decades of IT experience. As a freelance writer, Posey has written thousands of articles and contributed several dozen books on a wide variety of IT topics. Prior to becoming independent, Posey was a CIO for a national chain of hospitals and healthcare facilities. He has also served as network administrator for some of the country’s largest insurance companies and for the Department of Defense at Fort Knox. In addition to his ongoing work in IT, Posey has spent the last few years actively training as a commercial scientist-astronaut candidate in preparation to fly on a mission to study polar mesospheric clouds from space. You can follow his space flight training on his website.

with