Function Compute provides various function templates. You can use function templates to create functions in the Function Compute console with efficiency. For example, you can create web crawler functions, functions used to automatically classify images, and functions used to access Object Storage Service (OSS). This topic describes how to use a function template to create a web crawler function in the Function Compute console.
- In the top navigation bar, select a region.
- In the left-side navigation pane, click Services and Functions.
- On the Services and Functions page, click Create Function. In the Template Function section, move the pointer over image-crawler and click Configure and Deploy.
- In the Configure Function section, set the parameters and click Create.
The following table describes the parameters.
Parameter Description Service Name The name of the service.
- If you have created at least one service, select an existing service from the drop-down list.
- If you have not created a service, enter a new service name. The system automatically creates a service with the specified service name.
Function Name The name of the function. Runtime The runtime environment of the function. You do not need to set this parameter. Instance Type The instance type for the function. Valid values:
- Elastic Instance
- Performance Instance
Function Handler The name of the function handler. You do not need to set this parameter. Memory The memory that is required to execute the function. Timeout The timeout period. Unit: seconds. Default value: 3.
If the execution of the function is not complete within the specified timeout period, the function fails to be executed.
Single Instance Concurrency The number of requests that can be concurrently processed by a single instance.After the function is created, the Code tab appears.
- On the Code tab, replace <your region> and <your bucket name> in the code with the information about your OSS bucket. You can also modify other
parts of the code in the code editor.
- Click Event. In the Test Event panel, modify the event parameter and click OK.
- Click Invoke to view the execution result of the function.