Configure file uploads

Updated at:

IoT Platform allows devices to upload files to your OSS buckets. This topic describes how to configure device file uploads to your OSS bucket.

Prerequisites

You must have an OSS bucket. For more information, see Create a bucket.

Background information

After a device uploads a file to IoT Platform, you can view, download, or delete the file in the IoT Platform console. For more information, see File management.

Once a device uploads a file to your OSS bucket, you can access and use it directly. However, you must first configure the bucket for file uploads.

Important

Files uploaded from devices to your OSS bucket cannot be managed in the IoT Platform console; for example, you cannot delete them from the console.

Limits

  • For a single product, you can add a maximum of 10 configurations. Each configuration uses a custom business ID that is unique at the product level. Different business IDs can be mapped to the same bucket.

  • After you add, update, or delete a file upload configuration, the change takes about one minute to take effect for file upload requests from devices.

  • The maximum size of a single file uploaded from a device over the MQTT protocol is 16 MB.

  • For files uploaded to your OSS bucket, the maximum size for a single file is 16 MB. There is no limit on the number of files or the total file size.

Important The OSS bucket must belong to the user who owns the device. The bucket region must be the same as the device region.

Configure file uploads to a bucket

To save device files to a target OSS bucket, you must first authorize and configure it.

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

  3. In the left-side navigation pane, choose device management > products. Then, find your product and click View in the Actions column.

  4. On the product details page, click the file upload configuration tab, and then click Add OSS bucket configuration.

  5. In the dialog box that appears, click Create next to the 'Role not created' message.

    If the role already exists, skip this step. For more information about the service-linked role, see Service-linked role for device file uploads.

    Important

    Before you configure a bucket, you must create a service-linked role in your Alibaba Cloud account. This role grants IoT Platform permission to save device files to your OSS bucket.

  6. Follow these steps to configure the target bucket:

    1. Enter a custom business ID. This ID must be unique within the product and cannot be changed after the configuration is saved.

      The business ID can contain uppercase letters, lowercase letters, digits, periods (.), and underscores (_). The ID must be 4 to 32 characters long and cannot start with a special character.

    2. From the bucket drop-down list, select the target bucket or enter the name of an existing bucket.

      For more information about bucket naming rules, see Bucket naming conventions.

      After you set a bucket, you can add a description. The description cannot exceed 500 characters.

    3. Click OK. The IoT Platform server validates the bucket value, checking if it belongs to your account, is in the correct region, and uses a standard OSS storage class.

      If the validation fails, the bucket configuration fails. You must reconfigure the bucket according to the on-screen message.

Manage bucket configurations

After you successfully add an OSS bucket configuration, find the corresponding business ID on the file upload configuration tab to perform the following actions.

Actions

Steps

Edit

You can modify the bucket and its description.

  1. In the Actions column for the business ID, click Edit.

  2. In the Edit OSS bucket configuration dialog box, modify the bucket or description.

  3. Click OK.

Delete

Warning

Deleting an OSS bucket configuration prevents devices from uploading files to that bucket. This action is irreversible, so proceed with caution.

  1. In the Actions column for the business ID, click Delete.

  2. Click OK.

Next steps

Develop the device-side logic for uploading files to your OSS bucket. For instructions, see Example 3: Upload files to a user's OSS bucket over MQTT.

For details about file uploads from devices, see Topics and data formats for file uploads.

Related documentation

Add a cloud product data source: To further process and analyze the uploaded files, you can import data from the OSS bucket into the Data Service of IoT Platform.