Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Learning AWS IoT

You're reading from   Learning AWS IoT Effectively manage connected devices on the AWS cloud using services such as AWS Greengrass, AWS button, predictive analytics and machine learning

Arrow left icon
Product type Paperback
Published in Jan 2018
Publisher Packt
ISBN-13 9781788396110
Length 278 pages
Edition 1st Edition
Languages
Tools
Arrow right icon
Author (1):
Arrow left icon
Agus Kurniawan Agus Kurniawan
Author Profile Icon Agus Kurniawan
Agus Kurniawan
Arrow right icon
View More author details
Toc

Table of Contents (10) Chapters Close

Preface 1. Getting Started with AWS IoT FREE CHAPTER 2. Connecting IoT Devices to AWS IoT Platform 3. Optimizing IoT Computing Using AWS Greengrass 4. Building Local AWS Lambda with AWS Greengrass 5. Expanding IoT Capabilities with AWS IoT Button 6. Visualizing AWS IoT Data 7. Building Predictive Analytics for AWS IoT 8. Securing AWS IoT 9. Other Books You May Enjoy

Setting up AWS IoT for your IoT project

In this section, you will learn how to set up your IoT project, utilizing the AWS IoT platform. The following is a list of steps to build your AWS IoT project:

  1. Register on AWS
  2. Select the IoT device
  3. Register AWS IoT
  4. Create a security certificate
  5. Configure security access

Let's go through these steps.

Creating an AWS account

AWS provides a complete solution to build your enterprise system, starting from a virtual machine and enterprise application, to machine learning and IoT. At the time of writing, Amazon offers a free one year trial access called AWS Free Tier for a newly registered user. You can access the full features with the limited scheme. You can register a new AWS account and get a free one year trial access at https://aws.amazon.com.

Most AWS can be accessed with the AWS Free Tier scheme. I recommend you do so. The AWS Free Tier registration page is shown in the following screenshot:

Selecting an IoT device

The next step is to select your IoT device. Each IoT device has unique capabilities. I suggest that you use the IoT device platform that is recommended by Amazon to minimize problems while developing and deploying. You can use one of the listed devices from https://aws.amazon.com/iot-platform/getting-started/#kits. Based on my experience, the Raspberry Pi board or IoT board with the Linux platform is easier, because most AWS IoT Device SDKs are supported.

I will show how various IoT device platforms access AWS IoT, with specific scenarios in this book. Register an IoT device for AWS IoT after you have decided what IoT device model is to be implemented. You should register it in order to obtain access rights in AWS IoT. You can register your IoT device on AWS IoT Management Console with the following steps:

  1. Navigate to https://console.aws.amazon.com/iot. You should see a form as shown in the following screenshot:
  1. Select the Onboard option from the left-hand menu. You can click on the Get started button within the Configuring a device section, which is shown by an arrow in the preceding screenshot.

Then, you will get information about connecting IoT device to AWS IoT, as shown       in the following screenshot:

  1. Select the development platform of the IoT device and AWS IoT SDK. In this scenario, I use Linux/OSX with Node.js for AWS IoT SDK:
  1. Now we create our IoT device name. You should define the IoT device type. To do so, you click on the Create a type button:
  1. Fill out the IoT device type and its description. You may define IoT device attributes. For a demo, we define the following two attributes as shown in the following screenshot:
    • name
    • device-value

If done, save this IoT device type.

  1. Then, go back to your IoT device registering. Fill out the IoT device name and its type. I filled macos-computer in the Name field, as shown in the following screenshot:
  1. If done, you should see your IoT device on the Manage | Things menu:

You can add additional IoT devices to simulate the AWS IoT scenario.

Creating a security certificate

Before we use AWS IoT, we should create a security certificate. Then, this certificate will be attached to our registered IoT device. Follow these steps:

  1. On AWS IoT Management Console, open your IoT device. Click on the Security option on the left-hand menu. You should see a form, as shown in the following screenshot:
  1. You should see a Create certificate button. Click on this button. Then, AWS IoT will generate private and public keys for your IoT device. Please download all certificate and key files:

These certificate and key files will be used in our program to access the  AWS IoT server. You should get four files, as follows:

    • Certificate file (*.pem)
    • Certificate public key file (*.key)
    • Certificate private key file (*.key)
    • Root certificate (*.pem) or (*.crt)
  1. Put all these files into a folder. Our program will access these files:

The next step is to write a program. We will do so in the next section.

Configuring security access for AWS IoT

Since AWS IoT applies security to protect its system, we should also comply to configure our AWS IoT security. Some steps are taken to configure our AWS IoT security. We will perform the following tasks:

  1. Create a policy
  2. Attach a policy to the IoT device certificate
  3. Attach the IoT thing to the certificate

To create a policy on AWS IoT, perform the following steps:

  1. Click the Policies sub-menu from the Secure menu, as shown in the following screenshot:
  1. Then, you should see a Create a policy button. Click on this button.
  2. Fill in your policy name. You should add three policy statements, as follows:
    • iot:Connect
    • iot:Subscribe
    • iot:Publish
  1. Don't forget to check the Allow checkbox for all the preceding policy statements:
  1. When done, save your AWS IoT policy. You should see your created policy on the Policies form, as shown in the following screenshot:
  1. The next step is to add our created policy into the IoT device certificate. You can open Secure | Certificates on AWS IoT Management Console. Click on the ellipsis () link so you get a context menu that is shown in the following screenshot. Click on the Attach policy option:
  1. Then, you get a dialog box. Select your created policy. When done, click on the Attach button to execute this task:
  1. The last step is to add our IoT device into a security certificate. Click on the ellipsis () on your certificate so you get a context menu. Select the Attach thing option on context menu:
  1. Select your IoT device and then click on the Attach button to perform this task:

Now your IoT device has a certificate and policy. You can access AWS IoT through the IoT device.

You have been reading a chapter from
Learning AWS IoT
Published in: Jan 2018
Publisher: Packt
ISBN-13: 9781788396110
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime
Banner background image