Defining a Function within a Service

Functions are defined inside the api.functions table within the service manifest.

# The function name is required
name = "myfunction"

# The `http` param defines an HTTP API entry for the function
# `verb` is an HTTP verb such as GET or POST
# Path parameters are denoted inside curly braces "{}"
http = { verb = "GET", path = "/path/maybe/with/{parameter}" }

# The authorizer id refers to an authorizer defined in the same service
authorizer_id = "<id>"

# The timeout in seconds after which the function is terminated, regardless of whether it has completed.
timeout_seconds = 3

# The size of the function in MB. AWS Lambda scales the CPU allocation with this value.
size_mb = 512

The authorizer_id refers to the table ID within the service manifest of the authorizer you wish to attach.

type = "iam"

authorizer_id = "my-auth"

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 updated