This topic describes how to develop a simple serverless Hello World application in the Function Compute console.

Prerequisites

You have registered an Alibaba Cloud account and completed real-name verification.

Activate the Function Compute service

  1. Click Buy Now.
    homepage
  2. Activate Function Compute as instructed.

Create a function

  1. Log on to the Function Compute console.
  2. In the top navigation bar, select your region.
  3. In the left-side navigation pane, click Service/Function.
  4. Click Create Function, select a function type, and then click Next.
    In this example, select Event Function to create an event function.creat_function
  5. In the Configure Function step, specify the required information and click Create.
    config_function
    Parameter Description Example
    Service Name
    • If you have created at least one service, select an existing service from the drop-down list.
    • If you have not created any services, enter a new service name. The system then automatically creates a service with the specified service name.
    service
    Bind Log If you enter a new service name to trigger the system to automatically create a service, you must select Bind Log.

    After you bind a log to the service, you can view execution logs of the function. These logs help you develop and debug your function.

    In this example, an existing service is selected, and therefore this parameter is not specified.
    Function Name Enter a name for your function. function
    Runtime Select a language, such as Python, Java, PHP, or Node.js. python3
    Instance Type Select an instance type for your function. Valid values:
    • Flexible Instance
    • Performance Instance
    For more information, see Instance specifications.
    Flexible Instance
    Function Handler Enter the name of the function handler. The value is in the format of [File name].[ Function name]. index.handler
    Memory Set the memory that is required to execute the function. The maximum value is 3,072 MB. Default value: 512 MB. 512 MB
    Timeout Set the timeout period. The maximum value is 600 seconds. Default value: 60 seconds.

    If the execution of the function does not complete before the specified timeout period expires, the function fails to be executed.

    60
    Single Instance Concurrency The number of requests that can be concurrently processed by a single Function Compute instance. The Python 3 runtime environment does not support this feature.
    On the Service/Function page, you can click the target service to view the function created for the service.create_function_result

Execute the function

  1. Log on to the Function Compute console.
  2. In the top navigation bar, select your region.
  3. In the left-side navigation pane, click Service/Function.
  4. Find the target function in the target service and click the name of the function.
  5. Open the Code Execution tab. You can then write your own code in the code editor.

    For more information about coding in different languages, see the introduction to programming languages. For more information about the programming languages supported by Function Compute, see Programming languages.

  6. Click Invoke.
    After the function is executed, you can view the result and detailed log in the lower part of the page.result