Connect to a cloud application

Updated at:

This topic describes how a cloud application uses the AccessKey of a Resource Access Management (RAM) user to connect to IoT Platform.

Prerequisites

  • Replace the AccessKey ID and AccessKey secret in the cloud application developed by the solution provider with the device provider's AccessKey ID and AccessKey secret. You must design the application to read the AccessKey ID and AccessKey secret from a configuration file.
  • To connect to a public instance of IoT Platform, you must specify an access domain name. The domain name contains the Alibaba Cloud account ID (UID). The device provider must provide the UID to the solution provider.
    Note A RAM user cannot view the Alibaba Cloud account ID.

Receive messages from the cloud

  1. The cloud application uses AMQP server-side subscription to receive messages forwarded by IoT Platform. For more information, see Use AMQP server-side subscription.
    Note The solution provider uses a RAM user AccessKey for development and testing.
  2. After the cloud application is handed over to the device provider, you can use the device provider's AccessKey to connect the cloud application to IoT Platform.

Send messages from the cloud to devices

  1. The cloud application uses the IoT Platform cloud software development kit (SDK) to send messages to IoT Platform. IoT Platform then forwards the messages to devices. For more information about the cloud SDK, see Cloud SDK Reference.
    Note The solution provider uses a RAM user AccessKey for development and testing.
  2. After the cloud application is handed over to the device provider, you can use the device provider's AccessKey to connect the cloud application to IoT Platform and send messages to devices.

Cloud application O&M

After the solution provider delivers the device firmware and cloud application, the performance of the devices may not meet expectations. In this case, the device provider can allow the solution provider to use a RAM user to help locate issues.

The following steps describe how to copy a device message and send it to the solution provider's debugger for troubleshooting if the cloud application encounters a fault while processing the message.

  1. Log on to the IoT Platform console with your Alibaba Cloud account.
  2. On the Overview page, find the instance that you want to manage and click the instance ID or instance name.

  3. In the navigation pane on the left, choose Message Forwarding > Server-side Subscription, and then click the Consumer Groups tab.

  4. Click Create Consumer Group. In the Create Consumer Group dialog box, enter a group name and click Confirm.

    The consumer group name must be 4 to 30 characters in length and can contain letters, digits, underscores (_), and Chinese and Japanese characters. Each Chinese or Japanese character counts as two characters.

  5. In the left-side navigation pane, choose Message Forwarding > Data Forwarding.
  6. On the Data Forwarding page, click Create Rule.

    Important

    If the Data Forwarding page of the latest version appears, click Back to Previous Version in the upper-right corner of the page. When the Data Forwarding page of the previous version appears, click Create Rule.

  7. In the Create Rule dialog box, set a rule name, select a data format, and then click Confirm. For more information, see Rule parameters.
  8. After you create the rule, configure the data forwarding rule. Edit the SQL statement to process message data and set the data forwarding destination to the consumer group that you created. For more information, see Step 6 in Configure data forwarding rules.
  9. The solution provider's debugger receives and processes messages from the device.