Updated on 2024-11-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 Buy Instance. 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. Select Create from scratch. Set Function Type to Event Function, enter a name (for example, iotdemo) for Function Name, select a runtime (for example, Python 3.9), and click Create Function.

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 navigation pane on the left, choose IoT > IoT Device Access. On the IoTDA console, click the instance name. On the displayed page, choose Rules > Data Forwarding, and click Create Rule.

    Figure 2 Creating a rule

  2. Enter basic information and click Create Rule.

    • Rule Name: Enter a custom rule name.
    • Data Source: select Device message.
    • Trigger: select device message reporting.
    • Resource Space: Retain the default value.

  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.

    Figure 3 Adding a forwarding target

  4. Start the rule.