Notes: Getting Started with AWS IoT Services

(Illustration: Before setting up the Raspberry Pi, let’s have a raspberry cake and relax:p Image source: Photo by Josselyn Solorzano on Unsplash)

Notes taking about the video Getting Started with AWS IoT Services presented by Kevin Tinn and hosted by AWS Meetup Group (Denver) on August 5, 2020. (The meetup event page is here. The slide is here.)


  • Overview of IoT Services
    • IoT Core
    • Greengrass
    • IoT Analytics
  • Raspberry Pi Setup
  • Demo: Communicating Directly with IoT Core
  • Connecting to cloud-based Data Pipeline
  • Configure Greengrass
  • Q&A

Repo Info

Overview of IoT Services

IoT Core

  • AWS IoT Core is a managed cloud service that lets connected devices easily and securely interact with cloud applications and other devices.
  • AWS IoT Core can support billions of devices and trillions of messages, and can process and route those messages to AWS endpoints and to other devices reliably and securly.
  • With AWS IoT Core, your applications can keep track of and communicate with all your devices, all the time, even when they aren’t connected.


  • AWS IoT Greengrass seamlessly extends AWS to edge devices so they can act locally on the data they generate, while still using the cloud for management, analytics, and durable storage.
  • With AWS IoT Greengrass, connected devices can run AWS Lambda functions, Docker containers, or both, execute predictions based on machine learning models, keep device data in sync, and communicate with other devices securely – even when not connected to the Internet.

IoT Analytics

  • AWS IoT Analytics is a fully-managed service that make it easy to run and operationalize sophisticated analytics on massive volumes of IoT data without having to worry about the cost and complexity typically required to build IoT analytics platform.
  • Data transformation and enrichment services that are optimized for IoT
    • Ad hoc query capabilities
    • Stored in time series database
    • Automated scaling

Raspberry Pi Setup

  • Format SD card
  • Extract OS
    • Use diskutil to get disk path using diskutil list
    • Mount disk using sudo mkdir /mnt && sudo mount -t msdos /dev/disk2 /mnt (please change /dev/disk2 to the result you got on previous step.)
    • Download OS
      • Noobs
      • Pi OS (Raspbian)
    • The openssh was not working in Pi OS in Kevin’s case.
  • Complete Pi setup and enable ssh
    • On the Pi: sudo raspi-config
    • Navigate to Interfacing Options and select P2 SSH
    • Restart the Pi: sudo restart
    • Get the hostname: hostname -I
    • Install vim: sudo apt install vim -y
    • Now we can connect to the Pi: ssh pi@your_pi_ip_address_here
  • Change the hostname on the Pi
    • sudo vim /etc/hostname –> change rsapberrypi to sensor-pi
    • sudo vim /etc/hosts –> uddate to sensor-pi
    • sudo reboot

Demo: Communicating Directly with IoT Core

  • Create Policy:
    • IaC: Pulumi (repo)
    • or… Navigate to AWS IoT > Secure > Policies > Create:
    • Update the ARN to have the topic name we will use for sensor data
    • Name your policy, set Effect to Allow and Action to iot:*
  • Create IoT Core instance, create a IoT device, certificates, IAM policy, and attach policy to cert
    • Naviagate to AWS IoT > Manage > Things
    • Create > Single Thing
    • Name it and give it a type
    • Download the 3 certificate-related files (a certificate for this thing (device pem file, device.pem.crt), a public key, a private key (private.pem).)
      • Press the Activate button
      • Download the root CA file: curl > AmazonRootCA1.pem
      • Put the thing pem and the private key files in the same dir as the CA file.
  • Associate the crtificate with the policy we created
  • Get your Thing Shadow: AWS IoT > Manage > Things > sensor-pi > Interact.
  • Copy the cert files to the sensor-pi using scp: scp AmazonRootCA1.pem priate.pem device.pem.crt pi@
  • ssh into the sensor-pi: ssh pi@
  • Verify openssl is available within python
    • python
    • import ssl
    • quit()
  • Get producer source code:
    • git clone
    • cd aws-meetup-group-data-services/pi

Demo: Get Py MQTT lib and run producer

  • Setup AWS IoT Py SDK
    • mkdir sdk && cd sdk
    • curl -o
    • unzip
    • sudo python install
    • cd ..
    • cp -rf ./sdk/AWSIoTPythonSDK ./
  • Run the producer with your interaction url:
    • python <identifier>-ats.iot.<region>

Demo: Connecting Sensor to Pi

  • Working with DHT22 digital humidity and temperature sensor.
  • Connect to sensor-pi and prepare it to get sensors readings in our pi-producer code
    • ssh pi@
    • cd aws-meetup-group-data-services/pi
    • sudo apt-get update && sudo apt-get upgrade
    • sudo pip3 install Adafruit_Python_DHT
    • cp
    • vim

Demo: Connecting to cloud-based Data Pipeline

  • Connect this sensor data to the data pipeline we created a few Meetups ago.
  • Create IoT rule with action to send data to Kinesis. AWS IoT > Acts > Rules.
  • There are multiple existing actions can be chosen from a long list.

(I skipped taking notes about the part about Kinesis.)

Configure Greengrass

Loading comments…