How to save data from Azure Iot Hub o AWS into MongoDB

Hi ! I would like to create a higly scalable iot solution wich save data sended by my devices into a mongoDB database. I don’t know what is the best chose between using MongoDB on a VM or Mongodb Atlas but I would like to do something like that :

  • with Azure :
    Devices → IoT Hub → Stream Analytics? OR Event Hub OR Function App → MongoDB-on-a-VM OR MongoDB Atlas OR CosmosDB-API-MongoDB
  • with AWS :
    Devices → IoT Core → IoT Analytics? → MongoDB-on-a-VM OR MongoDB Atlas

Do you have any suggestions, advices, recommandations for best practices ?
In Addition I never used AWS and I am just starting with Azure, so if you have any tutorials, getting started, guides to deploy that I will take it !
Thank you in advance

There are a few ways to do what you are asking within these cloud providers. At a most basic level you can accomplish data movement from the edge to Atlas using MongoDB Realm Sync on the device. Here is a Ream Sync IoT example.

Devices (Realm Sync) → MongoDB Atlas (Azure, AWS, GCP)

If you want to introduce an event platform like Apache Kafka, you can send data through Kafka into MongoDB Atlas and achieve massive scale. Here is a blog post by Confluent that discusses this architecture IoT Reference Architecture and Implementation Guide Using Confluent and MongoDB Realm | Confluent Build Your Own IoT Platform with Confluent and MongoDB.

If you want to use cloud specific platform like Azure Event hubs for example, you can integrate Kafka Connect with that and use the MongoDB Connector for Apache Kafka to move data into MongoDB Atlas. Blog post here.


Tanks you very much for your advices, I will take a look on it !