Function component lets you add serverless functions to your app. It uses AWS Lambda.
Constructor
- Tab Title
- Tab Title
- Tab Title
- Tab Title
sst.config.ts
Parameters
handler
Path to the handler for the function.
- For Node.js:
{path}/{file}.{method}format - For Python:
{path}/{file}.{method}format - For Go:
{path}to the Go module - For Rust:
{path}to the Rust crate
runtime
The language runtime for the function.Supported values:
"nodejs18.x", "nodejs20.x", "nodejs22.x", "nodejs24.x", "go", "rust", "provided.al2", "provided.al2023", "python3.9", "python3.10", "python3.11", "python3.12", "python3.13"timeout
The maximum amount of time the function can run. Between 1 second and 900 seconds (15 minutes).
If a function is connected to API Gateway, it will time out after 30 seconds regardless of this setting.
memory
The amount of memory allocated for the function. Between 128 MB and 10240 MB in 1 MB increments.
link
Link resources to your function. This will:
- Grant permissions to access the resources
- Allow you to access them in your function using the SDK
environment
Key-value pairs of Lambda environment variables.
The total size of environment variables cannot exceed 4 KB.
permissions
Permissions to access other resources. These are added to the function’s IAM role.
url
vpc
Connect the function to private subnets in a VPC.Where
myVpc is:Properties
name
arn
url
nodes
SDK
When you link a Function to another resource, you can access it in your function code using the SDK.src/lambda.ts
Examples
Set additional config
sst.config.ts
Link resources
Link resources to the function:sst.config.ts
src/lambda.ts
Enable function URLs
sst.config.ts
Customize bundling
sst.config.ts