Easy connection between Raspberry Pi and AWS IoT

Connection settings between Raspberry Pi and AWS IoT

The basic connection method is easy to follow AWS IoT Development Guide. However, there are two methods, and I tried both. Here, we will explain how to use the "Connection Wizard", which is easy and much faster to set up. (If you are ready, it will take about 30 minutes)

environment

Setup steps

--Enter the AWS IoT menu from your PC --Onboard selection --Device onboard --Click how to start --Platform selection --Select Linux / OS X --Selection of AWS IoT Device SDK --Here, select Python --Click Next --Registration of things. Register the name of Raspberry Pi. --Download connection kit --connect_device_package.zip is downloaded スクリーンショット 2020-04-25 18.41.01.png --Unzip the file downloaded to your PC --Unzipped directory name: connect_device_package --There are the following files - RaspberryPi_test.cert.pem - RaspberryPi_test.private.key - RaspberryPi_test.public.key - start.sh --According to the README, communication encryption uses an X.509 certificate with the TLS protocol. --Transfer the file downloaded to your PC to Respberry Pi --Create an arbitrary directory on Raspberry Pi --Copy each directory to Raspberry Pi with scp command from PC --Open a command terminal on your PC -$ scp -r Copy source directory name User name @ IP address: Raspberry Pi path --Run the shell you copied from the Raspberry Pi terminal - $ sudo ./start.sh --The following error occurred in my environment - start.sh: 19: ./start.sh: pushd: not found --Add #! / Bin / bash to the first line of start.sh and execute again --aws-iot-device-sdk-python is coulombed from git --The MQTT sample application was successfully executed after being connected to the cloud, and the connection was confirmed! --Directory of sample application to be executed: aws-iot-device-sdk-python / samples / basicPubSub --Sample shell to be executed: basicPubSub.py

Another connection method

-From "Getting Started with AWS IoT Core" in AWS IoT Development Guide It is also possible to proceed one by one. --From the point of view of connecting with Raspberry Pi, it is wonderful that there is "Use AWS IoT Device SDK with Raspberry Pi" in the menu. This is probably because the Raspberry Pi is widespread for IoT devices or learning. However, it's a pity that the development guide doesn't explain the Python SDK. For now, the "Use AWS IoT Device SDK with Raspberry Pi" menu only uses the AWS IoT Device SDK for Embedded C and the AWS IoT Device SDK for JavaScript and Node.

That's how to connect. Experience with the two methods has shown that it is much easier to set from the "onboard" menu.

Points to consider

When I tried various connection methods, I got an error that the key and certificate did not match when connecting. The method of checking with the openssl command was convenient. Qiita link The connection confirmation by the pub / sub program is described in another Qiita article.

Reference material

For the AWS IoT Python SDK, see GitHub for a script description.

Recommended Posts

Easy connection between Raspberry Pi and AWS IoT
Raspberry Pi and AWS IoT connection program example
Easy IoT to start with Raspberry Pi and MESH
Send data from Raspberry Pi using AWS IOT
Connection between flask and sqlite3
Easy introduction to home hack with Raspberry Pi and discord.py
Run AWS IoT Device SDK for Python on Raspberry Pi
MQTT on Raspberry Pi and Mac
Easy and easy IoT life using Micropython!
Create your own IoT platform using raspberry pi and ESP32 (Part 1)
Pet monitoring with Rekognition and Raspberry pi
[Raspberry Pi] Add a thermometer and a hygrometer
AWS EC2 instance launch and ssh connection
AWS IoT device life and death monitoring
IPsec gateway VPN construction with CentOS 8 and openSUSE (Raspberry Pi) --2 StrongSwan VPN connection confirmation
Raspberry Pi 3 x Julius (reading file and grammar file)
Easy Raspberry Pi GUI App Development Beginner Part 1
Differences between queryStringParameters and multiValueQueryStringParameters in AWS Lambda
MQTT RC car with Arduino and Raspberry Pi
Easy Raspberry Pi GUI App Development Beginner Part 2
Serial communication between Raspberry pi --Arduino Uno (Python)
Get temperature and humidity with DHT11 and Raspberry Pi
Edit and debug the code in the Raspberry Pi with VS Code's SSH connection feature
How to set up a VPN gateway to establish a connection between Alibaba Cloud and AWS
Raspberry Pi backup
Simple VPN construction of IPsec gateway with Ubuntu 20.04 and Raspberry Pi --2 StrongSwan VPN connection confirmation
Create your own IoT platform using raspberry pi and ESP32 (Part 2) ~ ESP32 setting L Chika
Create a color sensor using a Raspberry Pi and a camera
Detect mask wearing status with OpenCV and Raspberry Pi
Measure temperature and humidity with Raspberry Pi3 and visualize with Ambient
Ubuntu 20.04 on raspberry pi 4 with OpenCV and use with python
Visualization of the connection between malware and the callback server
Installation of Docker on Raspberry Pi and L Chika
Install pyenv on Raspberry Pi and version control Python
Getting Started with Yocto Project with Raspberry Pi 4 and WSL2
Troubleshoot with installing OpenCV on Raspberry Pi and capturing
Use raspberry Pi and Julius (speech recognition). ③ Dictionary creation
Create your own IoT platform using raspberry pi and ESP32 (Part 3) ~ ESP32 settings Analog temperature sensor
Raspberry Pi + python + IoT device, environment construction procedure to start image processing and machine learning