Cloud-native API Gateway trigger
Function Compute supports Cloud-native API Gateway as an event source. Function Compute can be configured as the backend service of an API. When a request reaches a Cloud-native API Gateway whose backend service is Function Compute, the function runs, and Function Compute returns the execution result to Cloud-native API Gateway.
Background information
The Cloud-native API Gateway trigger is similar to API Gateway triggers. After Function Compute is integrated with Cloud-native API Gateway, you can securely expose your functions as APIs and address issues such as authentication and traffic control. The difference is that when Cloud-native API Gateway is integrated with Function Compute, it no longer distinguishes between event functions and web functions. Instead, it uniformly matches requests based on routing rules and forwards them to Function Compute.
Cloud-native API Gateway can be integrated only with Function Compute 3.0.
Create a function and integrate it with Cloud-native API Gateway
Step 1: Create a function
Log on to the Function Compute console and create a function. For instructions, see Function creation.
Step 2: Create a backend service
-

-
The screenshot shows the key configuration items. Keep the other configuration items at their default values.

Configuration item
Description
Domain Name
Services can be managed by using a domain name. In this topic,
example.comis used only as an example. Add and select your own domain name to make your service accessible through that domain name.Path
Set the routing path. Different paths trigger different functions to run.
Backend Services
Select the Function Compute 3.0 function backend service created in Step 2.
Step 3: Verify the result
-
Get the second-level domain name of the environment to which the service is bound.
-
Call the published API to run a test. This topic uses a call made with the curl command as an example.
curl -i -X GET env-ct6ovnem1hknd****-cn-hangzhou.alicloudapi.com/fcThe following sample response is returned:
HTTP/1.1 200 OK access-control-expose-headers: Date,x-fc-request-id content-disposition: attachment content-length: 11 content-type: application/json x-fc-request-id: 1-674eae6c-15b2172f-7db950e70148 date: Tue, 03 Dec 2024 07:08:28 GMT req-cost-time: 29 req-arrive-time: 1733209708197 resp-start-time: 1733209708226 x-envoy-upstream-service-time: 28 server: istio-envoy hello world