All Products
Search
Document Center

Function Compute:Quick start

Last Updated:Jan 22, 2026

Serverless Devs is an open-source developer tool for serverless applications. It provides full lifecycle management for your projects and allows you to quickly create, deploy, and invoke functions. This topic uses a function with a Python runtime as an example to describe how to manage functions using Serverless Devs.

Procedure

Step 1: Install Serverless Devs

You can install Serverless Devs using the command line interface, downloading a binary file, or running a script. This topic uses installation with the npm package management tool as an example to describe the steps.

  1. Install Node.js and the npm package management tool.

    For installation instructions, see the official Node.js website.

    Note

    Node.js must be version 14 or later. After installation, you can run the node --version command to check the Node.js version.

  2. Run the following command to install Serverless Devs.

    sudo npm install @serverless-devs/s -g
  3. Run the following command to verify the installation.

    sudo s -v

    The following is an example of the output from a successful installation.

    @serverless-devs/s: 3.0.1, s-home: /root/.s, linux-x64, node-v14.17.4

Step 2: Configure Serverless Devs

  1. Obtain your Alibaba Cloud key.

    When you create an AccessKey, make sure to save the AccessKey secret. For more information, see Create an AccessKey.

    Note

    Your AccessKey ID and AccessKey secret are your credentials for accessing the Alibaba Cloud API. These keys grant full permissions to your account. You must keep them secure.

  2. Follow the guided steps to configure the key.

    1. Run the following command to select a cloud vendor.

      sudo s config add

      Output:

      > Alibaba Cloud (alibaba)
        AWS (aws)
        Azure (azure)
        Baidu Cloud (baidu)
        Google Cloud (google)
        Huawei Cloud (huawei)
        Tencent Cloud (tencent)
      (Move up and down to reveal more choices)
    2. Select the desired cloud vendor and press Enter. This topic uses Alibaba Cloud (alibaba) as an example.

    3. Follow the interactive prompts to configure your key information.

      Please select a provider: Alibaba Cloud (alibaba)
       Refer to the document for alibaba key:  http://config.devsapp.net/account/alibaba
       AccountID 188077086902****
       AccessKeyID yourAccessKeyID
       AccessKeySecret yourAccessKeySecret
       Please create alias for key pair. If not, please enter to skip default
      
          Alias: default
          AccountID: 188077086902****
          AccessKeyID: yourAccessKeyID
          AccessKeySecret: yourAccessKeySecret
      
      Configuration successful

Step 3: Initialize a sample function

  1. Run the following command to create a Hello World project in Python.

    sudo s init start-fc3-python

    The output is as follows:

       More applications: https://registry.serverless-devs.com
    ? Please input your project name (init dir) start-fc3-python
    Downloading[/v3/packages/start-fc3-python/zipball/0.0.8]...
    Download start-fc3-python successfully
    
    ...
    Region where the application is created
    ? Region cn-huhehaote
    Must contain only letters, digits, underscores (_), and hyphens (-). Cannot start with a digit or a hyphen. The length must be 1 to 128 characters.
    ? Function name start-python-8i32
    Region where the application is created
    ? python runtime python3.9
    ? please select credential alias default
    
        * Before using, please check whether the actions command in Yaml file is available
        * Carefully reading the notes in s.yaml is helpful for the use of the tool
        * If need help in the use process, please apply to join the Dingtalk Group: 33947367
    
    
       Thanks for using Serverless-Devs
       You could [cd /start-fc3-python] and enjoy your serverless journey!
       If you need help for this example, you can use [s -h] after you enter folder.
       Document ❤ Star: https://github.com/Serverless-Devs/Serverless-Devs
       More applications: https://registry.serverless-devs.com

    After the project is initialized, a start-fc3-python folder is created in the current directory. This folder contains the following files:

    • s.yaml: The resource definition file for Function Compute. This file is written in YAML format.

    • code: The code folder contains the index.py file. You can edit the function's code logic in this file.

    • readme.md: The manifest file, which defines the modules and configuration information required for the project.

  2. Run the following command to navigate to the project folder.

    cd start-fc3-python

Step 4: Deploy the function

Run the following command to deploy the function to Function Compute. The function's metadata, such as its name, runtime, and memory, is defined in the s.yaml file.

sudo s deploy

The output is as follows:

   Steps for [deploy] of [hello-world-app]
====================

✔ [hello_world] completed (3.1s)

   Result for [deploy] of [hello-world-app]
====================
region:         cn-huhehaote
description:    hello world by serverless devs
functionName:   start-python-8i32
handler:        index.handler
internetAccess: true
memorySize:     128
role:
runtime:        python3.9
timeout:        30

A complete log of this run can be found in: /Users/x1/.s/logs/0229164849

Step 5: Invoke the function

Run the following command to invoke the function.

sudo s invoke -e "test"

The output is as follows:

   Steps for [invoke] of [hello-world-app]
====================
========= FC invoke Logs begin =========
FunctionCompute python3 runtime inited.
FC Invoke Start RequestId: 1-65e045b1-123e1745-79e146cd8b01
2024-02-29T08:52:01.317Z 1-65e045b1-123e1745-79e146cd8b01 [INFO] b'test'
FC Invoke End RequestId: 1-65e045b1-123e1745-79e146cd8b01

Duration: 2.38 ms, Billed Duration: 3 ms, Memory Size: 128 MB, Max Memory Used: 8.78 MB
========= FC invoke Logs end =========

Invoke instanceId: c-65e045b1-12f566fe-ca21d8fe46f1
Code Checksum: 3418420950487476908
Qualifier: LATEST
RequestId: 1-65e045b1-123e1745-79e146cd8b01

Invoke Result:
test
✔ [hello_world] completed (0.46s)

A complete log of this run can be found in: /Users/x1/.s/logs/0229165200

Step 6: Delete the function (Optional)

If you no longer need to use the function, you can run the following command to delete it.

sudo s remove

The output is as follows:

   Steps for [remove] of [hello-world-app]
====================
Remove function: cn-huhehaote/start-python-8i32

     ? Are you sure you want to delete the resources listed above yes
✔ [hello_world] completed (11.67s)

A complete log of this run can be found in: /Users/x1/.s/logs/0229165500