Use Cloud-native API Gateway as an event source for Function Compute. When a request reaches the gateway, it triggers the associated function to run and returns the result to the caller.
Only Function Compute 3.0 can be integrated with Cloud-native API Gateway.
How it works
Cloud-native API Gateway sits in front of your functions and handles routing, authentication, and traffic control. Unlike the classic API Gateway trigger, Cloud-native API Gateway does not distinguish between event functions and web functions — routing rules match incoming requests and forward them to Function Compute based on the path and domain you configure.
The request flow is:
A client sends an HTTP request to the gateway's domain.
The gateway matches the request against your routing rules and forwards it to Function Compute.
Function Compute runs the function and returns the result.
The gateway sends the response back to the client.
Prerequisites
Before you begin, ensure that you have:
A Function Compute 3.0 function. See Function creation
Access to Cloud-native API Gateway to create gateway instances, HTTP APIs, services, and routes
Integrate a function with Cloud-native API Gateway
Step 1: Create a function
Log on to the Function Compute console and create a function. For details, see Function creation.
Step 2: Set up a backend service
2.1 Create a gateway instance
Create a gateway instance in Cloud-native API Gateway. For details, see Create a gateway instance.
2.2 Create an HTTP API
Create an HTTP API under the gateway instance. For details, see Create an HTTP API.
2.3 Create a service
Create a service that points to your Function Compute function. For details, see Create a service.

2.4 Create a route
Create a route to connect the HTTP API to the backend service. For details, see Create a route.
Configure the following parameters. Leave the remaining parameters at their default values.

| Parameter | Description |
|---|---|
| Domain Name | The domain used to access the service. The example.com shown in the figure is a placeholder — add and select your own domain. |
| Path | The routing path. Different paths trigger different functions. |
| Backend Services | The backend service you created in step 2.3. |
2.5 Publish a routing rule
Publish the routing rule to make the route active. For details, see Publish a routing rule.
Step 3: Verify the integration
Get the second-level domain name of the environment bound to the service.
Call the published API. The following example uses curl:
curl -i -X GET env-ct6ovnem1hknd****-cn-hangzhou.alicloudapi.com/fcA successful response looks like:
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
What's next
To manage authentication and traffic control policies, see the Cloud-native API Gateway documentation.
To use the classic API Gateway as a trigger instead, see API Gateway trigger.