Giter Site home page Giter Site logo

aws-iot-intel's Introduction

Getting Started with AWS IoT on Intel Edison

Intel Edison + AWS IoT

Prepare Your Intel Edison

Get started with your Intel Edison by updating to the latest firmware and setting up a serial terminal. You can find the instructions here:

Get started with Intel Edison technology

Prepare Your Intel Edison for AWS IoT

Before you continue, we recommend that you read the AWS IoT Quickstart. If you are already familiar with AWS IoT, continue to the next step.

Install the AWS CLI

The AWS CLI is used to interoperate with Amazon Web Services. To view the help documentation, you must install Groff and a different version of less.

We assume you have internet access from the device to download and install these packages.

Install the Python Package Manager (pip)

Setup the Edison repo by replacing anything you have in the /etc/opkg/base-feeds.conf file with the following

src/gz all http://repo.opkg.net/edison/repo/all
src/gz edison http://repo.opkg.net/edison/repo/edison
src/gz core2-32 http://repo.opkg.net/edison/repo/core2-32

Setup the IoT repo and apply the new configurations.

echo "src intel-iotdk http://iotdk.intel.com/repos/3.0/intelgalactic/opkg/i586" > /etc/opkg/intel-iotdk.conf
opkg update

Install pip with setuptools.

wget https://bootstrap.pypa.io/get-pip.py --no-check-certificate 
python get-pip.py
wget --no-check-certificate https://bootstrap.pypa.io/ez_setup.py
python ez_setup.py --insecure

Install the AWS CLI

Install the AWS CLI by issuing the following command:

$ pip install awscli

Install Dependencies

To view help files using the aws iot help command, the Groff and a non-BusyBox version of less packages are required.

Groff Installation

Execute the following commands to install Groff:

$ wget http://ftp.gnu.org/gnu/groff/groff-1.22.3.tar.gz
$ tar -zxvf groff-1.22.3.tar.gz
$ cd groff-1.22.3
$ ./configure
$ make
$ make install
$ export PATH=$PATH:/usr/local/bin/
$ cd ~

Less Installation

First, rename the old version of less:

$ mv /usr/bin/less /usr/bin/less-OLD

Next, install the new version of less:

$ wget http://www.greenwoodsoftware.com/less/less-458.zip
$ unzip less-458.zip
$ cd less-458
$ chmod 777 *
$ ./configure
$ make
$ make install
$ cd ~

To make sure everything is installed correctly, run the IoT help file:

$ aws iot help

Setting Up Your Edison as an AWS IoT Thing

Get AWS Credentials

The AWS CLI is now installed. Create a new IAM user and get API credentials from the AWS Management Console by following the steps in Getting Set Up with the AWS Command Line Interface. After you have an access ID and key, configure the AWS CLI credentials by issuing the following command:

$ aws configure 

NOTE: To configure AWS IoT, ensure that your default region is set to a region where AWS IoT is available such as us-east-1. The default output format can be left as JSON.

In order to get permission to download the AWS IoT tools, attach the administrator account policy to the user. In the IAM console, in the Users panel, select the user you created, attach the policy, and then select the administrator account.

Register Your Edison

In terms of AWS IoT, your Intel Edison device is a thing. To start registering your Edison with AWS IoT, issue the following command:

$ aws iot create-thing --thing-name myEdison

Generate Certificates

  1. Create a folder where your certificates will be stored:

    $ cd ~
    $ mkdir aws_certs
    $ chmod 700 aws_certs
    $ cd aws_certs
  2. A client certificate must be generated to authenticate to the AWS IoT topic with MQTT. Run the following to create the certificate:

    $ aws iot create-keys-and-certificate               \
         --set-as-active                                 \
         --certificate-pem-outfile my_certificate.pem    \
         --public-key-outfile my_public_key.pem          \
         --private-key-outfile my_private_key.pem
  3. At the top of the output, locate the certificateArn property. Copy the value, which has a pattern of arn:aws:iot:<region>:<accountId>:cert/<certificateId>. You will use this value when you attach the certificate to the AWS IoT policy.

Create and Attach the AWS IoT Policy

Create a JSON policy document for the AWS IoT SDK. For more information about AWS IoT policies, see Authorization in the service documentation.

The following policy allows all IoT actions and should be used for development purposes only.

  1. Copy the following text (CTRL+C):

    {
        "Version": "2012-10-17",
        "Statement": [
            {
                "Effect": "Allow",
                "Action": [
                    "iot:*"
                ],
                "Resource": [
                    "*"
                ]
            }
        ]
    }
  2. Enter vi policy.json, hit "a", and right-click to paste the text.

  3. Press ESC and type in :wq to save and quit.

  4. Create the IoT policy by issuing the following command:

    $ aws iot create-policy                             \
         --policy-name EdisonPubSubToAnyTopic            \
         --policy-document file://policy.json

Attach the Policy to Your Certificate

  1. If you have misplaced the certificateArn value, you can issue the following command to locate it:

    $ aws iot list-certificates
  2. Attach the policy to the certificate by issuing the following command:

    $ aws iot attach-principal-policy                   \
         --principal <certificate_arn>                   \
         --policy-name EdisonPubSubToAnyTopic 

aws-iot-intel's People

Contributors

coreyc avatar kevinmellott91 avatar rpcme avatar vielmetti avatar w4ilun avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.