The OSS console supports the automatic decompressing of ZIP files. This feature also requires Function Compute. You need to configure the trigger in a required bucket in the OSS console. Currently, OSS can only decompress ZIP files. The following sections describe how to configure the feature and some cautions that you should pay attention to.
- Configure the OSS console
- Modify a trigger
- Modify a target directory
- Delete a trigger
- Extend functions
Go to the OSS console, select the required bucket, and then click the Function Compute tab, as shown in the following figure.
Note: If you have not activated Function Compute, the system indicates that you activate Function Compute before performing the following operations.
Click the ZIP package unzip button to go to the page for editing the OSS trigger, as shown in the following figure.Configure the following parameters on the edit page:
- Service Authorization: authorizes Function Compute to read from and write to OSS and to execute functions in the specified bucket in OSS. Click the Authorized button to set a RAM user. Each trigger requires the authorization.
- Trigger Role: authorizes OSS to access Function Compute. This setting is required only once.
- Prefix: specifies the prefix of files that trigger functions. We recommend that you set this parameter. If you do not set this parameter, the system matches all ZIP files in the bucket by default. As a result, functions may run cyclically. For more information, see FAQ.
- Target Directory: specifies the directory where you place extracted files. If you do not set this parameter, OSS extracts files to the current bucket by default.
- I agree to activate Function Compute and process zipped files using Function Compute.: Decompressing ZIP files is a value-added service. During the operation, Function Compute calculates billing based on the duration of decompression.
To modify a trigger, click Edit Trigger next to the required trigger to go to the page for modifying the trigger, as shown in the following figure.
You can modify the trigger event, prefix, and suffix. We recommend that you do not change the suffix, because the system has created functions based on the suffix to ensure normal service logic.
To modify the directory that you extract files to, click Edit under Function Properties on the Overview page. Then, change the environmental variables on the Basic settings dialog box that appears, as shown in the following figure.
To delete a trigger in the OSS console, click Edit Trigger next to the target trigger to go to the page for editing the trigger. Then, click Delete to delete the trigger. We recommend that you delete the corresponding function so that OSS cannot decompress ZIP files.
Function Compute generates a system function that enables the OSS console to decompress ZIP files. You can modify function code as needed. For example, small ZIP files require little processing time, so you can specify lower memory to save costs. Similarly, for ZIP files of more than 1GB, we recommend that you set a longer timeout to minimize timeout occurrences.To decompress other types of files in addition to ZIP files, you can extend functions. Currently, Function Compute supports functions in Python2.7 by default.