Get started Bring yourself up to speed with our introductory content.

Get started with this AWS IoT tutorial for beginners

AWS IoT Core is a cloud service that connects, controls and manages your IoT devices. In this AWS IoT tutorial for beginners, you'll learn what is required to set up and connect an IoT device to AWS IoT Core.

This video walks through the process of onboarding an Ubuntu 18.04 device using the AWS IoT Core Python SDK. You can use a similar process for other Linux, OS X and Windows devices, using either Node.js or Java. There are also SDKs for Android, iOS, Arduino, C++ and options for embedded C. In short, wherever you want to run an IoT device, there is an SDK option available to you.

The SDKs all have open source libraries, developer guides and samples to help you get up and running. In this video, we'll use one of the SDK samples to show you how to make a simple publish/subscribe workflow.

Along with managing devices connected to AWS IoT Core, this video also covers how to define a device policy. The policy enforces certificate authentication so your device can communicate with the AWS IoT service in a secure method. The video also covers how to build and manage device types and how to administer the physical inventory of your IoT devices.

Finally, this AWS IoT tutorial for beginners wraps up with an example of how to parse data coming from the IoT device -- or "thing," in AWS parlance -- and send it to other Amazon cloud services, such as S3 buckets or Lambda functions. In this example, we'll dump the device data into an IoT Analytics workspace that will enable future processing.

In order to follow along with this tutorial in your own environment, you'll need the following prerequisites:

  • An AWS account;
  • The ability to create resources in AWS;
  • A Linux device with python3; and
  • Internet access.

There are many ways to use AWS IoT Core, and this video tutorial is a good place to start your AWS IoT journey.

View All Videos
Transcript - Get started with this AWS IoT tutorial for beginners

Welcome, today we're going to discuss how to get up and running with AWS IoT Core. As you know, AWS IoT Core is a solution to help you manage [IoT] devices. So what we're going to do today is create a small Ubuntu thing to get up and going.

So first we have the AWS Console. And within the console, we're going to go ahead and onboard a device. And you'll see that we have options for onboarding many devices or onboarding a single device. In this case, we're going to go ahead and just onboard one device. And we have options here for registering a device, downloading the connection kit and configuring them to test the device. We're going to go ahead and hit that Get started button.

Now, what you have from a platform perspective is managing Linux/OSX, Windows, Node.js, Python and Java. There is also an Embedded C option that's available in preview. Today, we're going to grab the Linux box and Python box. And we're going to go ahead and generate a thing. You'll see we also have options for thing types. And we also have options for attributes. Now, a thing type is something that you can have when you have a large fleet of devices out in the field. Maybe you have an IoT device itself from Amazon, maybe you have a Raspberry Pi -- [or a] different kind of physical hardware -- how you can track and manage those. And then also those three key value pairs that you have that are searchable on the attribute field, so maybe dev or some other kind of status. We're going to set this down on it, go ahead and skip Next.

And what this generates is a connection kit. So this has the certificate and private key that we need to manage it and also has the policy. So the policy is what defines how this thing can talk to and communicate with the AWS IoT service. So, in this case, it's to be able to publish and receive from the SDK test Python configuration on topics.

This also gives you a start script to go ahead and get going and helps manage dependencies. I'll go ahead and download this and copy it over to the system. I'm already SSHed in this box on this, and I've already got the configuration enabled, I do have Python installed and PIP installed. What we get out of this file is our start.sh script, our root certificates and our device certificates.

So let's take a look at that start.sh script. So, this has some dependency management that it does for you -- the certificates, user authentication. And then when it gets done, it actually executes the basic Python example with the root certificate and the device to do a basic Pub/Sub. So let's take a look at that script -- basic licensing information, importing some packages for management. We're configuring our arguments so that we can manage and determine what certificates are used or what parameters are used to manage the device. After that, it's just using our configurations to define allow actions. And then at the bottom, we have this loop. So essentially, until the end of time or you stop this loop, this does a simple "Hello, World!" to the published topic. We run that script and you'll see that it does that "Hello, World!" and then it's writing to the SDK test Python topic that's available.

Now, this is basically what you would then change to configure things in your deployment when you need to send anything to the IoT service. You know, maybe it's been another piece of hardware, it's getting environmental data, or any other kind of connectivity. Somehow the system generate gets that data and then sends it to the AWS IoT service.

Now going back to the portal, we'll go ahead and look at the connection monitor. And then we have a lot of connection devices that are coming through and that will ask to give your information about how the messengers manage. So, is it in MQTT or HTTP protocol? And then what kind of data is it getting? And then, of course, inbound/outbound traffic. You'll see that a number of messages have been published, and then you'll have rule execution.

Now, so far, we have a Ubuntu device sending data to the AWS IoT service. So how do we act on that. There's the Act pane. And we'll go ahead and Create a new action. And then we have this query statement where you're pulling information from the topic and then doing different kinds of information with it. In this case, we're just going to grab everything from the topic, but you could have a lot more different high-level complex queries about what data is coming out of here for. And the example here, you know, it's temperature greater than 50 degrees. But whatever complex SQL commands you want, you can manage how two different actions occur.

A lot of options for what you can do with this data. When you're pulling out of here, you could dump it to DynamoDB, Lambda functions, Simple Notification Service, S3 buckets. Right now, we're going to send it to the IoT Analytics service. We're going do a Quick Create here. This will go ahead and create our channel data store, pipeline data set and roles for us automatically. You could create a manual configuration if you needed to.

We also really do Error action. So, if something happens incorrectly with this, we'll go ahead and do that. So, we'll do a push notification in the event of an error failure.

Now we have a name, a description, what we parse the information on, send it to IoT analytics and then our error handling. And we'll go and create this rule. Now, you see we have two rules and you can enable and disable rule sets individually, which is used for testing.

Now, if you go look at the analysis services and pull up IoT Analytics, we have our channels, which is how we're parsing data into the system, the pipelines for managing that data, data store, of course where it's being stored, the data query we're running and then our analytic notebooks.

So, look at the demo_channel here. So far, we got a little bit of data for the first time that's connected -- 14 messages. And then the second time, more additional messages here, so about 36. And then as this updates, this will then of course change and show you more insights into what that service is ingesting, based upon that rule configuration you set up earlier. And then of course, you can create analytics and integration on the notebooks to pull more insights out of that.

A couple things to help you kind of manage this. You have the Defend tab. So when you have a lot of devices out in the field, how do you kind of manage and track. So auditing things across your fleet, and manage those devices from a compliance perspective. There's tooling to help you go through that. Then there's the violation detect policies. So when you have a device that starts doing information or pulling opponent information, that is not how you originally defined it, then you can help create this security profile to show you that that's delineation from design practice.

Now, there's also some additional software information available to you. So, you have those RTOS devices that are pulling information from the cloud. There's IoT Greengrass Core. This extends this functionality we discussed far out to devices locally so they can perform local acts, perform local information without having to talk back to the service. And then as you see over time, you'll get more data and you'll get more rules analytics out of this. There's also the shadow updates service, so you can track that device on the back end. Even if it does go offline, it will track that device state based upon the information to it. For example, if you set a state to like a light to a different color, when the light comes back online, it connects to the shadow service and it sets that back to the appropriate state. And finally, there's the test service. So, subscribe to topic, publish to topic. Make sure you can test and configure the information that you're expected to see in a quicker process than having to physically interact with the device itself.

And then finally, those Types that we talked about. In this case, you know, we have a pizero, that's you know, out in the field doing something. There's a ubuntu server, you know, managing something. This could be a cell device, this could be manufacturing data. So, then you can have different policies configuration based upon the different types of devices you've had. This sky's pretty much the limit for what you want to do once you get connected and start writing to your Python or Node.js code and interacting with the environment or other different services, integrating that with, you know, Azure functions or Lambda services and other ways to get going.

So, I hope this helped you get up and running with the AWS IoT service and realize how easy it is to get up and going with that service. So good luck and happy hacking.

+ Show Transcript
Data Center
ITOperations
SearchAWS
SearchVMware
Close