IoT Device Simulator
IoT Device Simulator

Architecture Overview

Deploying this solution builds the following environment in the AWS Cloud.

        IoT Device Simulator architectural overview

Figure 1: IoT Device Simulator architecture

The AWS CloudFormation template deploys a device simulator API, which leverages Amazon API Gateway to invoke the solution’s microservices (AWS Lambda functions). These microservices provide the business logic to perform CRUD operations on virtual devices and device types, record simulation metrics, and perform administration tasks. These microservices interact with Amazon Simple Storage Service (Amazon S3), Amazon DynamoDB, AWS Identity and Access Management (IAM), and Amazon CloudWatch Logs to provide data storage, management, and logging functions.

The solution also deploys an Amazon Virtual Private Cloud (Amazon VPC) network topology with two public subnets and two private subnets that contains the solution’s simulation engine, which runs in Amazon Elastic Container Service (Amazon ECS) containers provisioned by AWS Fargate. The VPC also includes a NAT gateway.

The solution creates a web console and deploys it into an Amazon S3 bucket configured for static website hosting. Amazon CloudFront is used to restrict access to the solution’s website bucket contents. During initial configuration, the solution also creates a default administrator role and sends an access invite to a customer-specified user email. The solution uses an Amazon Cognito user pool to manage user access to the console and the device simulator API.

When the device simulator API receives an authorized request, Amazon API Gateway invokes the appropriate Lambda function. The Lambda function returns the execution results to the API, which returns the results to the simulator console.

When a device simulation request is received, the device microservice sends the request to a simulation queue in Amazon Simple Queue Service (Amazon SQS). The simulation engine polls the simulation queue for simulation start and stop requests.

When a start simulation request is received, the solution will spawn a virtual device based on the request and start publishing simulated data to the defined AWS IoT endpoint for the duration defined in the device type definition. Each simulation runs until the defined execution duration expires or a stop request is received. When a stop simulation request is received, the solution will terminate the simulation based on the request and update the device catalog.