Functions
Defining a Function within a Service
Functions are defined inside the api.functions table within the service manifest.
1
[api.functions.function-id]
2
# The function name is required
3
name = "myfunction"
4
5
# The `http` param defines an HTTP API entry for the function
6
# `verb` is an HTTP verb such as GET or POST
7
# Path parameters are denoted inside curly braces "{}"
8
http = { verb = "GET", path = "/path/maybe/with/{parameter}" }
9
10
# The authorizer id refers to an authorizer defined in the same service
11
authorizer_id = "<id>"
12
13
# The timeout in seconds after which the function is terminated, regardless of whether it has completed.
14
timeout_seconds = 3
15
16
# The size of the function in MB. AWS Lambda scales the CPU allocation with this value.
17
size_mb = 512
Copied!
The authorizer_id refers to the table ID within the service manifest of the authorizer you wish to attach.
1
[api.authorizers.my-auth]
2
type = "iam"
3
4
[api.functions.my-func]
5
authorizer_id = "my-auth"
Copied!
Please see the next section on Authorizers for further details.

HTTP Functions

The default API provider is Amazon API Gateway. Each service has a corresponding gateway endpoint, and specifying an HTTP verb and path for your function will create the corresponding routes & integrations. You can view details such as the generated API URL in your AWS Console.
Last modified 2mo ago
Copy link