Function Compute is an event-driven service. The execution of a function can be triggered by a certain event. When a request arrives at the API gateway, where Function Compute is set as the backend service, the API gateway calls the function. Function Compute then returns the execution result to the API gateway.
This example describes how to use the API gateway to trigger the function. You can learn how to use the API gateway to call a function, how to use the parameters from the API gateway to call the function, and return the processing result to the API gateway.
To run a function triggered by the API gateway event source, follow these steps:
- Create a function.
- Write function code.
- Create API, and set Function Compute as the API Gateway backend service in the API Gateway console.
- Test the function.