You can use the data forwarding feature of the rules engine to forward processed data to ApsaraDB RDS instances for storage. This article describes how to forward data to a destination.
- An ApsaraDB RDS instance is created in the region where your IoT Platform instance resides. The database engine of the instance must be MySQL or Microsoft SQL Server and the network type of the instance must be VPC. A database and table are created. For more information about how to use ApsaraDB RDS, see the ApsaraDB RDS documentation.
- A data forwarding rule is created and an SQL statement that is used to process data is written. For more information, see Configure a data forwarding rule.
- Data forwarding is supported between IoT Platform instances and ApsaraDB RDS instances that reside in the same region. For example, you can forward the data of an IoT Platform instance in the China (Shanghai) region to an ApsaraDB RDS table that resides only in the China (Shanghai) region.
- You can forward data to ApsaraDB RDS instances that resides only in VPCs.
- You can forward data to MySQL and SQL Server instances.
- Data forwarding is supported between standard databases and privileged databases.
- You can forward data only in the JSON format.
- Log on to the IoT Platform console.
- In the left-side navigation pane, choose .
- Click View next to the required rule. The Data Forwarding Rule page appears.
- In the Data Forwarding section, click Add Operation.
- In the Add Operation dialog box, select Save to RDS in the Select Operation field. Set the parameters and click OK.
Parameter Description Select Operation Select Save to RDS. Select a region Select the region where your IoT Platform instance resides. RDS instance Select the ApsaraDB RDS instance. Database management Enter the database name.Note If you use a privileged database, you must enter a database name. Account Enter the account of the ApsaraDB RDS instance. This account must have the read and write permissions on the database. Otherwise, the rules engine cannot write data to the ApsaraDB RDS instance.Note After the rules engine obtains the account, the rules engine writes only the data that matches the specified rule to the database. No extra operations are performed. Password Enter the password that is used to log on to the ApsaraDB RDS instance. Table Name Enter the name of the table that is created in the database. The rules engine writes data to the table. Key Enter the name of the field in the table. The rules engine writes data to the field. Value Enter the value of the field in the topic of the SQL statement as the value of the key.Note
- The data type of the key must be the same as the data type of the value. Otherwise, you may fail to save this parameter.
- You can enter a variable, for example,
Role Authorize IoT Platform to write data to ApsaraDB RDS.
- Go to the Data Forwarding page, find the required rule, and then click Start in the Actions column of the rule.
- Log on to the ApsaraDB RDS console. On the Data Security page, configure a whitelist or view whitelists. After you set the parameters, the
rules engine adds the following IP addresses to the ApsaraDB RDS whitelist. Then,
the rules engine can communicate with ApsaraDB RDS. If one of the following IP addresses
is not displayed in the whitelist, you must manually add the IP address.
- China (Shanghai):
- Singapore (Singapore):
- US (Silicon Valley):
- US (Virginia):
- Germany (Frankfurt):
- Japan (Tokyo):
- China (Shanghai):