UIFlow - Connecting to AWS

Overview

This tutorial will explain how to program with the UIFlow platform to connect devices to the AWS Cloud Service Platform for subscribing and publishing data.

Create a Device

Before connecting, you need to register a new device through the AWS Management Console. Click here to access the AWS Management Console , complete account creation and log in.
Click on AWS services -> IoT Core to enter the AWS IoT management page.

Click Manage -> Things -> Create things to create a new device.

Create a device according to your needs. This demonstration will show the creation of the most basic single thing. For more details on device types, please refer to the AWS official documentation .

Enter the device name, configure the device's group and category, click Next -> create a device certificate.

Before proceeding to the next step, we need to click Create policy to create a device policy.

On the creation page, click Advanced mode, refer to the configuration below to create. Note: For ease of testing, the permission demonstrated here is Allow, but in actual production deployment, it can be defined according to security needs.

{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Effect": "Allow",
      "Action": "iot:*",
      "Resource": "*"
    }
  ]
}

Upon completing device creation, a download page for keys and certificates will pop up. Note: This page will only appear once, so please follow the prompts to download the Device certificate, Public Key File, and Private Key File to your local machine. (These files will be used for communication verification in subsequent operations)

Firmware Flashing

Flash your device with UIFlow firmware (requires version v1.8.0 and above). Click the link below for detailed flashing steps.

UIFlow Firmware Flashing Steps

Write the Program

Click the add button on the initialization block and sequentially import the Device certificate and Private Key File. Note: Default key and certificate file names are too long; try to shorten them as much as possible. The parameter things name should match the device name created and be consistent with the name in the AWS Management Console.

Copy the Endpoint field from AWS Management Console -> Settings and fill it into the HOST parameter. We use the MQTT service

Copy the Endpoint field from AWS Management Console -> Settings, and fill it into the HOST parameter. For the port parameter, we use the MQTT service port 8883, and for keepalive, enter 60. For more information about service ports, please refer to the AWS official documentation .

Copy the Endpoint field from AWS Management Console into HOST parameter, use MQTT service port 8883, and keepalive as 60. For more about service ports, refer to AWS official documentation.

Add the execution programs for subscription and publication, and specify the topic information. Click the run button at the top right corner of the UIFlow page to execute the program.

Add subscription and publication execution programs, specify topic information, and click run on UIFlow page to execute.

Subscribe and Publish Messages

Click AWS Management Console -> Test to enter the online test page. This feature is used to test MQTT messages of devices in your AWS account. Click Additional configuration to adjust the QoS level.

Publish topic: Fill in the Topic and Message payload, then click Publish to publish.

Publish topic by filling in Topic and Message payload, then click Publish.

Subscribe to a topic: Fill in the Topic, then click Subscribe to subscribe. Click Additional configuration to set the display message type. Received messages will be displayed in the console at the bottom of the page.

Subscribe to a topic by filling in Topic, click Subscribe, and adjust settings in Additional configuration to set display message type.

On This Page