Two Ways to Create a “Thing” in the Internet of Things

Dmitri Zimine
3 min readOct 20, 2017

--

Quick & dirty notes and hints while learning AWS IOT

To play with Internet of Things, we need things. To play with AWS IoT, we need to create and configure things. Yes, eventually they’ll come in many interesting form factors. But what is the best and fastest to get things going? How do I quickly create a “Thing” on my computer, register and connect it to AWS IoT, send messages and tinker with SDK?

There is a hard way and a fast way. The hard is actually not hard at all, so start with it.

Create a thing, take 1: Device SDK with AWS console and local docker

I can get the “thing” SDK on my laptop. But rather than turning my laptop into a “thing”, I’d rather have it isolated. Containerized, I mean :) Yes, a quick docker container to contain a “thing” with AWS IoT SDK. Or a few of them. Here is a step-by-step:

1. Go to AWS Web console’s Onboard page, select “Configuring a device” “Connect to AWS IoT”, click “Get Started” — it will get you to Connect to AWS IoT wizard.

2. Pick OS and SDK, give your “thing” a name, and download deployment package — it contains certificates, and a script that installs the SDK and runs a sample at the end to send messages to the test topic. I selected Linux/Python. Download the package and and unzip it to local directory:

mkdir ~/thing
cd ~/thing
mv ~/Downloads/connect_device_package.zip .

3. Create a simple docker file:

# ~/thing/Dockerfile 
FROM python:2.7
ADD . /code
WORKDIR /code
CMD [“/bin/bash”]

4. Build docker image

build -t dzimine/thing .

Run docker container from the image, mapping the current directory to enjoy your favorite editor on the host laptop while exploring the IoT SDK.

run -it -v “$(pwd)”:/code dzimine/thing

Now in the container, run the ./start.sh. The script will download and setup the AWS IoT SDK, and run the sample app to send messages to AWS IoT testing topic. You’ll see the messages at the last step of your “Register a thing” wizard, or go to IoT Test Page on AWS console.

Care to build a better docker image? Look at start.sh. and fancy yourself with the Dockerfile using it as a hint.

Create a thing, take 2: ELF

2) Now, the easy way. Get this awesome “thing” client https://github.com/awslabs/aws-iot-elf. ELF stands for “Extremely Low Friction”, and indeed the friction is extremely low. Assuming you already have aws CLI installed, “it just works”. Hit this…

python elf.py create

… and go see your thing. Hit that…

python elf.py send --topic foo/bar

… and see the messages popping up at AWS console IoT Test page.

What is next?

Pick your poison and explore the IoT device SDK and MQTT protocol. ELF example does more — in addition to “being a thing”, it uses boto3 library to create things on AWS side and updates the shadows.

--

--

Dmitri Zimine

Technical leader, devops enthusiast, software geek. Sharing my professional opinions on medium.