Multi-File Zipping

Last updated: 2021-10-08 11:26:24

    Overview

    COS’s SCF-based multi-file zipping feature allows you to add multi-file zipping rules to your bucket. You can specify the URLs of files that need to be zipped, and trigger the cloud function to zip the files and save the generated package to the specified path in the bucket.

    Notes

    • The generated package cannot be larger than 50 GB.
    • If you have added a multi-file zipping function rule to your bucket via the COS console, the function will appear in the SCF console. DO NOT delete the function. Otherwise, your rule may not take effect.
    • Regions where SCF is available support multi-file zipping, including Guangzhou, Shanghai, Beijing, Chengdu, Hong Kong (China), Singapore, Mumbai, Toronto, and Silicon Valley, and more. For more supported regions, please see SCF Documentation.
    • If an error is reported when you zip the files, click View Log on the right of the function to quickly redirect to the SCF console to view the error logs.
    • Multi-file zipping is not supported for files stored in the ARCHIVE or DEEP ARCHIVE storage classes. To zip these files, you need to restore them first. For detailed directions, please see Restoring Archived Objects.
    • Multi-file zipping depends on the SCF service, which provides users with a free tier. You will be billed for the part exceeding the free tier limit according to SCF Pricing. Note that the more and larger the files you zip, the more resources will be used; the more often you zip your files, the more calling times will be incurred.

    Directions

    1. Log in to the COS console.

    2. Click Application Integration in the left sidebar and then select the Data Processing tab.

    3. In the Multi-File Zipping area, click Config function.

      Note:

      If you haven’t activated SCF, please go to the SCF console to activate it and authorize the service as instructed.

    4. Click Add Function and perform configuration in the pop-up window, as shown below:

      • Function Name: uniquely identifies a function and cannot be modified after it is created. You can view the function in the SCF console.

      • Execution Method: execution method for the function. If you set this field to Sync, the execution results will be returned after the zipping task is complete. If you set this field to Async, the function will respond directly and execute the zipping task in the background.

      • Authentication Method: authentication method for the function

        • If you select SCF, you need to trigger the function using a role that has permission to call the function.

        • If you select No, you need to select an appropriate API gateway to receive requests. If you don’t have an API gateway in this region, click Create API Gateway service, and we will configure an API gateway suitable for this function in this region.

      • API Gateway Service/API Path/Request Method: For more information about API gateway configurations, please see API Gateway Overview.

      • SCF Authorization: You need to authorize SCF so that it can read files in your bucket and save the generated package to the specified path.

    5. Click Confirm.

    6. Click Instructions to view the field description, where ClientContext is in JSON format. For the configuration demo, please see Using APIs to Zip Files.

    7. Click Next to go to Calling Test page.

    8. Click Start, and the function will be called as configured. You can view the response of the function in Response.

    9. You can perform the following operations on the created function:

      • Click View Log to view the historical running status of multi-file zipping. If an error is reported, you can click View Log to quickly redirect to the SCF console to view the error log details.
      • Click Edit to modify the multi-file zipping rule.
      • Click Delete to delete an unwanted multi-file zipping function.