tencent cloud

Feedback

Create a Function

Last updated: 2023-02-01 17:37:37

    SCF offers multiple function creation methods. This document describes how to create a function through the console and command line tool.

    Creating functions via the console

    1. Log in to the SCF console and click Function Service on the left sidebar.
    2. Select the region and namespace where to create a function at the top of the Functions page and click Create to enter the function creation process as shown below:
    3. On the Create function page, select a function creation method as needed.
    • Template: You need to enter the required function name and use configuration items in the function template to create the function.
    • Create from scratch: You need to enter the required function name and runtime environment to create the function.
    • Use TCR image: You can create a function based on a TCR image. For more information, see Usage.
    1. Configure the basic information of the function.
      1. Add a tag in Fuzzy search to find a template as shown below:
      2. Select the template and click Next.
      3. Enter the basic information of the function.
        • Function name: The function name is automatically populated by default and can be modified as needed.
        • Region: The region is automatically populated by default and can be modified as needed.
        • Time zone: SCF uses the UTC time by default, which you can modify by configuring the TZ environment variable. After you select a time zone, the TZ environment variable corresponding to the time zone will be added automatically.
    2. Configure the function code.

      The runtime environment and execution method are automatically populated by default as shown below:

    3. In Log configuration, choose whether to enable log delivery as shown below:

      Log delivery is disabled by default. After it is enabled, the execution logs of the function can be delivered to the specified location in real time. For more information, see Log Delivery Configuration.
      Note

      Currently, you cannot select the log template for image-based functions and HTTP-triggered functions.

    4. In Advanced configuration, configure the environment, permission, layer, and network of the function as needed. For more information, see Function Overview.
    5. In Trigger configurations, choose whether to create a trigger. If you select Custom, see Trigger Overview.
    6. Click Complete. You can view the created function on the Functions page.

    Creating Function on CLI

    You can create a function as needed in more ways as detailed below:

    Contact Us

    Contact our sales team or business advisors to help your business.

    Technical Support

    Open a ticket if you're looking for further assistance. Our Ticket is 7x24 avaliable.

    7x24 Phone Support