This topic describes how to use Function Compute, including how to create a service, create a function, trigger a function, view execution logs, and view service monitoring data.

Procedure

You must activate Function Compute before you can use related services. For more information, see Activate the Function Compute service.

The following figure shows the procedure for using Function Compute.

workflow

Create a function in the Function Compute console

You can use the Function Compute console to perform operations such as creating services, creating functions, and debugging functions. For more information, see Create a function in the Function Compute console.

Create a service

A service is the basic unit of resources in Function Compute. You can grant permissions, configure logging, and create functions for a service. For more information, see Manage services.

Create a function

A function is the basic unit for resource scheduling and running in Function Compute. A function specifies the logic of code. To create a function, you must write code by using a method specified by Function Compute and deploy the code to Function Compute as a function. A service in Function Compute is similar to a microservice in the software application architecture. When you build an application in Function Compute, you must abstract the business logic into microservices based on your business requirements and implement the microservices as services in Function Compute.

Test a function

In Function Compute, you can trigger a function directly or by using events. Use one of the following methods to trigger a function based on your business requirements:

Use Serverless Devs to manage function resources

You can use Serverless Devs to build, debug, and deploy applications. For more information, see Manage function resources by using Serverless Devs.

Build an application

Initialize a project, configure the s.yaml file in the generated project directory, and then build an application in the project directory. After that, a .s file is generated in the current directory to store the outputs. You can use the file to debug and deploy applications on your local computer.

Debug an application

After an application is built, you can debug the application on your local computer based on the function type to check whether the function can run as expected.

Deploy an application

After you create and debug an application, you can deploy the application to Function Compute. After the function is deployed, the services and functions configured in the s.yaml file are deployed to Function Compute with one click.

FAQ

For answers to commonly asked questions of Function Compute, see Overview.