Updated on 2023-12-15 GMT+08:00

Preparation

Before creating a forwarding rule, create an IoTDA instance as well as products and devices. In this best practice, we only create an instance for testing.

Creating an IoTDA Instance

  1. Log in to the IoTDA console. In the navigation pane, choose IoTDA Instances.
  2. On the right of the IoTDA Instances page, click Enable Free Standard Edition. The parameter configuration page is displayed. Set the parameters based on service requirements.

    Figure 1 Enabling free standard edition

  3. Click Create.

Creating a Function

  1. In the left navigation pane of the management console, choose Compute > FunctionGraph. On the FunctionGraph console, click Create Function.
  2. Enter iotdemo for Function Name, select a runtime (for example, Python 3.9), and click Create.

Creating a Forwarding Rule

Forwarding rules are used to transfer data from IoTDA to trigger specified functions. For this purpose, you can create forwarding rules in IoTDA or create an IoTDA trigger in FunctionGraph. Perform the following procedure to create a forwarding rule:

  1. In the left navigation pane of the management console, choose IoT > IoTDA Device Access. On the IoTDA console, choose Rules > Data Forwarding, and click Create Rule.

  2. Enter basic information and click Create Rule.

    • Set Rule Name to iotfg or another one.
    • For Data Source, select Device message.
    • For Trigger, select device message reporting.

  1. To set the forwarding target, click Add, and select FunctionGraph.
  2. If this is the first time you select FunctionGraph, authorize access to IoTDA.
  3. Select function iotdemo.

  4. Start the rule.