September 7, 2020

AWS IoT Event-Driven Architecture

scroll

At Synadia, we love to implement AWS IoT core Services in our projects. Services like FreeRTOS, AWS Greengrass, AWS IoT Core, AWS IoT Device Defender, AWS IoT Analytics are at the heart of our projects and enable us to deliver scalable and secure solutions to our customers. We like to think out of the box and don’t limit ourselves by using these services only to the typical IoT Projects. We believe that AWS IoT core Services can deliver a broader purpose than just connecting devices to the cloud.

Event-driven microservices Architecture

As Synadia we architect our solutions using a variant of the service-oriented architecture (SOA) structural style which arranges an application as a collection of loosely coupled modules (services) each supporting a specific business function and utilizing event-driven architecture pattern.

This design, known as a distributed asynchronous architecture pattern, is used to create highly scalable reactive applications. The model suits our customer needs very well, and we have discovered that IoT Core fits perfectly for these purposes! The primary use case for us is to deliver and process events asynchronously which IoT core handles correctly. As a result, our services (modules) interact with each other by publishing and receiving messages from the IoT Core using it as an event bus.

Architecture

IoT Architecture

The above architecture is a simplified overview of a PaaS offering based on a fully Serverless design. This solution is an event-driven application that processes product transactions scanned by end-users in a retail environment.

  1. The process starts when an end-user scans (RFID/NFC) a product that is selected. The device creates a message (topic) that is buffered in AWS Greengrass before it continues to AWS IoT Core.
  2. The message gets passed to every service that is listening, resulting in a fully decoupled architecture. In this case, the “Transaction” is received by the Transaction and the Payment Service.
  3. The Transaction Service receives and validates the message and Triggers a lambda that will parse the Transaction and stores the Transaction in the AWS DynamoDB using AWS AppSync.
  4. The Payment Service will fetch any existing balance from the end-user and update the balance with the value of the Transaction Using the AWS DynamoDB using AWS AppSync.
  5. In the case of a food allergy or ingredient notification, a second message is sent via the allergy topic.
  6. The Notification will listen to the “Allergy” topic and will trigger an AWS Lambda that will create a push message using the Amazon SNS Service.
  7. Using AWS Cloudfront and AppSync Subscriptions, all events and updates are synced near real-time. 

This solution implements a clean version of a microservices architecture entirely based on AWS Managed Services. Alternatively, IoT can also be supported with AWS Event Bridge. However, we believe that this would introduce a new layer with additional complexity and no extra features on top of the IoT Core implementation.

CDK Deployment Kit

For the first time, Synadia has used the AWS Cloud Development Kit (AWS CDK) as the only development framework to deploy the entire solution. CDK is an open-source software development framework to model and provision your cloud application resources using familiar programming languages. As a team, we have adopted this new framework and replacing CloudFormation, Amplify & Terraform as our previous development stacks. By introducing typescript as our primary coding language, we also introduced new opportunities compiling functionality. As a result, our maintainability, productivity and quality have significantly increased.

Are you also looking for an AWS Partner that has extensive experience with IoT Frameworks, Serverless development and PaaS Solutions please feel free to reach out to our sales contacts or the author of this blog.

Remi van Wijngaarden
Remi van WijngaardenManaging Partner

Get Synadia updates

Our newsletter with inspiration about the latest trends, projects we are proud of and much more that will make our innovative heart beat faster.