You can configure the rules engine to forward processed data to ApsaraDB for RDS instances in VPCs.


  • The ApsaraDB for RDS instances and your IoT Platform service must be in the same region. For example, if your devices are in cn-shanghai region, the data can only be forwarded to RDS instances in the cn-shanghai region.
  • Only RDS instances in VPCs are supported.
  • Only MySQL instances and SQL Server instances are supported.
    Note MySQL 8.0 is not supported.
  • Databases in classic mode and master mode are supported.
  • Binary data cannot be forwarded to ApsaraDB for RDS.


  • Follow the instructions in Configure data forwarding rules to create a rule and write a SQL script for processing data.
  • Create an ApsaraDB for RDS instance that is in the same region as your devices, and then create a database and a data table.


  1. Click Add Operation next to Data Forwarding, and then select Save to RDS.
  2. Configure the following parameters as prompted:
    Parameter Action
    Select Operation Select Save to RDS.
    RDS Instance Select the VPC RDS instance to which IoT Platform data is to be forwarded.
    Database Enter the name of the target database.
    Note If your database is in the master mode, you need to manually enter the database name.
    Account Enter the account of the RDS database. The account requires the permissions to read and write data to the database. Otherwise, rules engine cannot write data to the database.
    Note After rules engine obtains the account, rules engine only writes data that matches this rule to the database.
    Password Enter the password to log on to the database.
    Table Name Enter the name of the table that will store data from IoT Platform. Rules engine will then write data to this database table.
    Key Enter a field name of the database table. Rules engine will then write data to this field.
    Value Enter a field of the message that you have defined in the data processing SQL statement. This is the value of Key.
    • Make sure that the data type of the Value field is the same as that of the Key field. Otherwise, the data cannot be written into the database.
    • You can enter a variable, such as ${deviceName}, to indicate that device names selected from the topic messages are used as the value.
    Role Set the role that authorizes IoT Platform to write data to RDS database table.

    If you have not created such a role, click Create RAM Role and create a role in the RAM console.

  3. In the Data Forwarding page, click the Start button corresponding to the rule to start this rule.
  4. Once the configuration is complete, the rules engine will add the following IP addresses to the whitelist to connect to RDS. If one or more of the following IP addresses are not listed, you need to manually add them to the whitelist of the RDS instance:
    • China (Shanghai):
    • Singapore:
    • US (Silicon Valley):
    • US (Virginia):
    • Germany (Frankfurt):
    • Japan (Tokyo):

    On the Security page of the RDS console, you can set and view the whitelist.