Above image is recent our PFC architecture diagram. I use both sides include On-premises and AWS Cloud.
I summarized some service used in PFC.
It is a key function to apply the IoT feature in PFC. AWS IoT supports the MQTT protocol and the SDK. I use the AWS IoT Device SDK for Python(https://github.com/aws/aws-iot-device-sdk-python). I have to generate the “Thing” on the AWS IoT Platform and install the x.509 certificate in PFC. It is the default policy of the AWS IoT, MQTT message broker on the AWS IoT would deny If the anonymous thing would connect to the broker. In other benefit is the security is strongly maintained by the default policy of the AWS IoT. If I would stop the support the service specific PFC, I achieve this goal through deleting the “Thing” on the AWS IoT platform.
Shadow DEVICE is the best feature When I consider how to maintain the state of individual PFC even PFC is the disconnection in the network or other reason(Signal has gone).
I divide the following process to synchronization and recovery the state of the PFC.
Full Synchronization(Get all state in the AWS IoT Shadow Thing) Regulary execute on the Raspberry PI.
Update Desired State of the PFC(Change the state of the PFC, Usually executed by the Lambda with the CloudWatch).
Upload the partially the state( Recent Sensor Data | Recent PFC real State) Execute on the Raspberry PI with time interval.
AWS IOT RULE ENGINE
RuleEngine is one of the important services to operates the PFC remotely and automatically. I set the rule in the Rule-engine Service with “Rule Query Statement”. I prefer the “Forward Chaining(Similar to the IF… THEN… clause)”. “RUle Query Statement” is an easy and intuitional query.
AWS CLI(Command Line Interface) is easy to use the SaaS on AWS using the command line. I install this CLI Library on the Raspberry Pi in PFC. You know, I set the IAM and Policy to execute the AWS CLI which only approve the execution AWS S3 Object bucket. I using this function to synchronization of the PFC image to AWS S3 data lake.
ELK STACK(ELASTICSEARCH / LOGSTASH / KIBANA STACK)
Filebeat on the Raspberry Pi throw the sensor data to the Logstash on the remote server(Not AWS, On-Premis server), After parsing on Logstash, this data insert to the ElasticSearch JSON Document and Kibana Import it and visualize.
LAMBDA FUNCTION (NOT! LAMBDA ARCHITECTURE.)
In AWS Serverless Lambda Function executed by the two type of events. One is the Rule Engine and other is the Cloud Watch. It is simple and useful change the state of the “shadow thing” or execute other services on AWS.
CloudWatch service is more knowns the Monitoring the Log on the AWS service and notification when the condition of the threshold satisfied. Fortunately, CloudWatch support “Event” feature, It is a very similar feature to the Linux Cron event schedule system. I used this feature to wake up the lambda function on time. “Recipe for growing plant” based the CloudWatch + Lambda Function Collarborationship.
This Famous Object Storage system, used archive the image data from the PFC and others such as data from the sensor. In my humble opinion, S3 is the best place to become the Data Lake for PFC. I expect this S3 object lifecycle reduce the cost and use a lot of the other service use the pipeline.
Dynamo DB is the NoSQL database, This feature is not considered use case in PFC, I use this feature only the key-value store base the time series.(I consider use other service or move to the S3)
From KwangHee Han.