Monogoto
Back to Monogoto website
  • Welcome
  • Getting Started
    • Quick Start
    • Device Configurations
      • IoT Modules
        • NORDIC nRF9160 DK
        • Quectel BG95-MX
        • Quectel BG96
        • Murata LBAD0XX1SC-DM
          • Satellite NTN Network
        • Sierra Wireless WP7607
        • Sierra Wireless WP7610
        • Sierra Wireless MC7700
        • SIMCom SIM7070G
          • Waveshare SIM7070G
        • SIMCom SIM7600G-H
          • Waveshare SIM7600G-H
        • Telit HE910
        • Thales Cinterion TX62
        • u-blox SARA R4
          • SODAQ SARA R41XM
        • Cellular Devices
          • Openwrt EG95
          • ProView 4GPro-W
          • Teltonika RUT240
          • Teltonika FMB920
          • InHand IR302
          • Provision-ISR PR-LTE01W
          • Sierra Wireless RV50 AirLink
          • Smart Cash Register Configuration to Use Cellular SIM as WiFi Backup
          • Nayax Nova 40
      • iPhone Device
      • Android Device
      • Raspberry Pi
    • Monogoto SIM
      • IoT SIM card
      • Embedded SIM
      • eSIM
      • iSIM
        • Murata LBAD0XX1SC
        • Quectel BG770A-SN
      • SGP.32
        • Kigen Pulse
      • Monogoto SIM Tool Kit (MTK)
    • Cellular Identities in Monogoto
    • Coverage Lists
      • Identity B Coverage
      • Identity C Coverage
      • Identity E Coverage
      • Identity F Coverage
      • Identity P Coverage
      • Identity U Coverage
      • NTN Satellite Coverage
      • LP-WAN Coverage
    • Features List
    • Community Forum
  • FAQ
  • Hub
    • Intro
      • Signup
      • Login
      • Logout
      • Users
        • Create a new user
        • Delete a user
        • Manage users
        • User password reset
      • General Elements
    • Dashboards
      • Active SIMs and Data Usage
        • Daily Active Things
        • Daily Data Usage
        • Top Consuming Things
        • Top Profiles in Use
        • Top Groups by Data Usage
        • Top Networks by Data Usage
        • Top Groups by Active Things
        • Top Networks by Active Things
      • Data Flows
        • Data Transfer
        • Top Destinations
        • Breakout
        • Services
        • Protocols
        • TCP Flags
        • Top Things (upload/download)
    • Things
      • Thing details
        • Understanding OPLMN and FPLMN on the Thing details page
      • Quality of Service
        • Thing QoS tests for public connectivity
        • Thing QoS monitoring for private connectivity
      • SMS
        • Incoming SMS
        • Outgoing SMS
        • SMS Monitoring
      • Location Service
      • NetFlow
    • Campaigns
      • Campaigns Table
      • Campaign Details
      • SMS Campaign
    • Private Networks
      • Backhaul
      • Edge
        • Edge Events
          • Time
          • Messages
          • msg-type
          • Node
          • Direction
          • Interface
          • Type
      • Radio
    • Inbox
    • Integrations
      • Slack
      • Zapier
      • Webhook
        • Webhook CDRs
          • Webhook SMS CDR
          • Webhook DATA CDR
      • Email
    • Captures
      • Basics on How to Read a Packet Capture File
    • Orders
      • Create a new order
    • Payments
  • Advanced Console
    • Intro
    • Security
    • Network
      • Create new Network
      • Edit Network Settings
      • Apply Network Settings
      • Delete Network
      • Add Network NAT
      • Edit Network NAT
      • Delete Network NAT
      • Add Network Route
      • Edit Network Route
      • Delete Network Route
      • Add Network VPN
      • Network VPN status
      • Edit Network VPN
      • Delete Network VPN
      • Download Network VPN configuration
      • Reconnect Network VPN
      • Ping Network VPN
      • How Devices in The Same Network Can Communicate with Each Other?
    • Things Groups
      • Create Things Group
      • Assign Things to Group
      • Edit Things Group
      • Delete Things Group
      • Override Roaming Policy
    • Things
      • Define Thing Status
      • Edit Things Details
      • Refresh Connection
    • Alerts
      • Alert Metrics (types)
      • Create New Alert
      • Disable/Enable Alert
      • Edit Alert
      • Delete Alert
    • Global Pools
    • Price Plans
    • Webhooks
      • Outgoing (MO) SMS Webhook
      • Incoming (MT) SMS Webhook
      • Outgoing (MO) Voice Webhook
      • Incoming (MT) Voice Webhook
      • Triggered Alert Webhook
  • Developer
    • API
      • Authentication
      • Things
        • Get Things List
        • Get Thing Information
        • Get Thing State
        • Update Thing State
        • Update Thing Name
        • Update Thing Description
        • Get Thing Data Session Status
        • Get Thing ICCID using IMSI
        • Get Thing Lifetime Data Usage
        • Get Thing Events Logs
        • Ping Thing IP Address
        • Lock Thing to IMEI
        • Download Thing PCAP File
        • Refresh Thing Network Connection
        • Get Things Services Usage Report
      • Things Groups
        • Get Things Group List
        • Move Thing to Different Things Group
        • Get Things Group Information
        • Lock Things Group to IMEI range (TAC)
      • eSIM
        • Get an eSIM
        • Cancel an eSIM
        • Download an eSIM
      • Alerts
        • Get Triggered Alerts
      • SMS
        • Check if MT SMS was Received
        • Send SMS to Thing
      • Pricing
        • Get Pricing Plan Information
      • Get Roaming Policy
    • Cloud Integrations
      • AWS IoT Core
      • Ubidots
  • Private Networks
    • Intro
      • Getting Started
      • Spectrum Allocation
    • Monogoto Edge
      • 4G Edge Components
      • 5G Edge Components
      • Edge NUC
      • Edge API
        • Authentication
        • Get Edge Configuration
        • Get Edge ID
        • Get Edge CID
        • Get MME S6A And AMF AUSF Status
        • Get Radio List
        • Get Subscriber Information
        • Get Subscription Status
        • Patch Subscription Status
        • Get IMSI IP Mapping
        • Patch IMSI IP Mapping
        • Delete IMSI IP Mapping
        • Get PLMN
        • Post PLMN
        • Get Network Operator Name
        • Patch Network Operator Name
        • Get APN
        • Get APN IP Pool Mapping
        • Get CDR Logs
        • Post PING
        • Get iperf
        • Patch iperf
        • Get Speed Test
        • Get Data Speed
        • Get Capture
        • Post Capture
    • eNodeB
      • Airspan AirVelocity 1500
      • Baicells Nova 227
      • Baicells Nova 442i
      • Baicells Neutrino 430
      • Baicells Nova 230i
      • BreezeCOMPACT 1000
      • Foxconn T99B226
      • Ubiik goRAN
      • Ubiik FreeRAN
      • T&W N02008
      • Mosolabs SCE4255W
      • Mosolabs SCO4255P
    • gNodeB
      • Mosolabs SCE5164
      • Baicells Stellar 227
    • CPE & UE
      • Airspan AirSpot 5410
      • Sierra Wireless EM7565
      • DG505G CBRS 5G USB Dongle
      • DG10 CBRS USB Dongle
      • D-Link DWP-1010W CPE
      • D-Link DWM-311-G 5G M2M
      • D-Link G530 Router
      • IPC SCB800 CBRS Camera
      • Telit LM960A9-P
      • Moxa 5G CCG-1510-US-T
      • InHand 5G ODU2000
      • Peplink MAX BR1 Mini 5G
      • T&W 5G Router
      • Telit LM960A18
      • Baicells EG7010C-M11 CPE
      • Baicells EG7035E-M11 CPE
      • Baicells EG8015G-M11 CPE
      • Telrad 9000 CPE
      • SRW620 CPE
      • Amit IDG500-0GT01
      • Jacs TD0231 Router
  • NTN Satellite Networks
    • NTN Satellite Coverage
    • NTN Billing
    • NB-IoT: Signaling NIDD vs IP Connectivity
    • VPNs in NTN
    • UDP Communication in NTN
    • How to Order NTN Developer Kit?
    • NTN Certified Devices
      • NTN Certified Modules
        • Murata LBAD0XX1SC-DM Satellite NTN Network
        • Quectel BG95-S5 Satellite NTN Network
        • Quectel BG770A-SN Satellite NTN Network
        • Quectel CC660D-LS Satellite NTN Network
        • SIMCom 7070G-HP-S Satellite NTN Network
        • Murata ALT1250 Satellite NTN Network
      • NTN Certified Chipsets
  • University
    • AT Commands
      • What AT Commands Should I Use to Debug a Connectivity Issue?
      • How to Send AT Commands to a Teltonika Router?
    • LTE bands
    • RAT Type (Radio Access Technology)
    • Low Power Modes: eDRX & PSM
    • What is MCC/MNC?
    • Glossary
Powered by GitBook
On this page
  • Quick Navigation
  • Prerequisites
  • Create a Thing in AWS
  • Connect your device to AWS IoT Core
  • Create your python script
  • Next steps

Was this helpful?

  1. Developer
  2. Cloud Integrations

AWS IoT Core

Connect your Raspberry Pi to AWS IoT Core, over a cellular connection

PreviousCloud IntegrationsNextUbidots

Last updated 2 years ago

Was this helpful?

Easily and securely connect devices to . AWS IoT Core uses MQTT to transmit and receive messages, a lightweight IoT messaging protocol. This tutorial explain how to set up AWS IoT Core and start sending IoT data from a Raspberry Pi connected over cellular.

Quick Navigation

Prerequisites

  • Monogoto SIM

  • Raspberry Pi 3 or 4

Create a Thing in AWS

Search for the IoT Core service

In the left side menu, navigate to Manage > All devices > Things

Click the button Create Things to create your digital Thing.

Name your thing, e.g. mqtt-thing

Select Auto-generate a new certificate

Attach an existing policy, or create a new one by clicking “Create policy”

When creating a new policy, add 4 statements allowing the Thing to Connect, Publish, Receive and Subscribe. Under Policy resource, add an asterisk * to allow all topic names to connect to AWS IoT Core.

Policy effect    Policy action    Policy resource
Allow            iot:Connect      *  
Allow            iot:Publish      *   
Allow            iot:Receive      *  
Allow            iot:Subscribe    * 

When using AWS IoT Core in production, restrict the Policy resource to specific topics to increase the security of your application.

Download all keys and CA files

Download and store the Device certificate, Private key file and Amazon Root CA 1 in a directory called certs. Make sure to name the files properly as described in the table below.

Device certificate

device.pem.crt

Private key file

private.pem.key

Amazon Root CA 1

AmazonRootCA1.pem

Connect your device to AWS IoT Core

Access the Raspberry Pi over ssh or by connecting a screen and keyboard

Install the required libraries

Before you install an AWS IoT Device SDK, run these commands in a terminal window on your Linux device to install the required libraries.

sudo apt-get install cmake
sudo apt-get install libssl-dev

Install the AWS IoT Device SDK for Python and download the sample apps to your device.

cd ~
pip3 install awsiotsdk
pip3 install AWSIoTPythonSDK

Add certificates to the Raspberry Pi

Add the Device certificate, Private key file and Amazon Root CA 1 to a folder called certs.

cd ~
mkdir certs

If you downloaded the certificates to a different machine, move the certificates to the RPI using the below command: scp -r ~/certspi@<ip address>:~/certs

Create your python script

Create a new file called publish.py containing the below script

# publish.py

# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
# SPDX-License-Identifier: MIT-0

import time as t
import json
import AWSIoTPythonSDK.MQTTLib as AWSIoTPyMQTT

# Define ENDPOINT, CLIENT_ID, PATH_TO_CERTIFICATE, PATH_TO_PRIVATE_KEY, PATH_TO_AMAZON_ROOT_CA_1, MESSAGE, TOPIC, and RANGE
ENDPOINT = "<your AWS endpoint>"
CLIENT_ID = "basicPubSub"
PATH_TO_CERTIFICATE = "/home/pi/certs/device.pem.crt"
PATH_TO_PRIVATE_KEY = "/home/pi/certs/private.pem.key"
PATH_TO_AMAZON_ROOT_CA_1 = "/home/pi/certs/AmazonRootCA1.pem"

MESSAGE = "hello world"
TOPIC = "device/RPI"
RANGE = 3

myAWSIoTMQTTClient = AWSIoTPyMQTT.AWSIoTMQTTClient(CLIENT_ID)
myAWSIoTMQTTClient.configureEndpoint(ENDPOINT, 8883)
myAWSIoTMQTTClient.configureCredentials(PATH_TO_AMAZON_ROOT_CA_1, PATH_TO_PRIVATE_KEY, PATH_TO_CERTIFICATE)

myAWSIoTMQTTClient.connect()
print('Begin Publish')
for i in range (RANGE):
    data = "{} [{}]".format(MESSAGE, i+1)
    message = {"message" : data}
    myAWSIoTMQTTClient.publish(TOPIC, json.dumps(message), 1) 
    print("Published: '" + json.dumps(message) + "' to the topic: " + TOPIC)
    t.sleep(0.1)
print('Publish End')
myAWSIoTMQTTClient.disconnect()

Replace <your AWS endpoint> with your AWS endpoint to the publish.py file (line 11)

In the Settings page you will find the Endpoint, which is unique to your AWS account and looks something like: abcdef1234567-ats.iot.eu-west-1.amazonaws.com.

In the AWS IoT Portal, open the MQTT test client and subscribe to the topic device/RPI

Go back to your Raspberry Pi and run the publish.py script using the command:

python3 publish.py

Expected response

Begin Publish
Published: '{"message": "hello world [1]"}' to the topic: device/data
Published: '{"message": "hello world [2]"}' to the topic: device/data
Published: '{"message": "hello world [3]"}' to the topic: device/data
Publish End

When looking at the MQTT test client in AWS IoT Core, you can see the messages:

Congratulations! I’ve successfully sent data from a Raspberry Pi connected to Monogoto, to AWS IoT Core using the MQTT protocol.

Next steps

Start by visiting the

This section explains how to run a python scrip on a Raspberry Pi, connected to Monogoto. For more information on how to connect the Raspberry Pi to Monogoto, see .

To find your AWS endpoint, go to the , near the bottom of the navigation pane, choose Settings.

Trigger actions using Lambdas -

Store data in DynamoDB -

AWS account
AWS portal
this tutorial
AWS IoT console
learn more
learn more
Create a Thing in AWS
Connect your device to AWS IoT Core
Create your python script
AWS IoT Core