Skip to content

ApiGatewayV1LambdaRoute

Reference doc for the `sst.aws.ApiGatewayV1LambdaRoute` component.

The ApiGatewayV1LambdaRoute component is internally used by the ApiGatewayV1 component to add routes to your API Gateway REST API.

You’ll find this component returned by the route method of the ApiGatewayV1 component.


Constructor

new ApiGatewayV1LambdaRoute(name, args, opts?)

Parameters

Properties

nodes

Type Object

The underlying resources this component creates.

nodes.function

Type Output<Function>

The Lambda function.

nodes.integration

Type Integration

The API Gateway REST API integration.

nodes.permission

Type Permission

The Lambda permission.

Args

api

Type Input<Object>

The API Gateway to use for the route.

api.executionArn

Type Input<string>

The execution ARN of the API Gateway.

api.id

Type Input<string>

The ID of the API Gateway.

api.name

Type Input<string>

The name of the API Gateway.

auth?

Type Input<false | Object>

Default false

Enable auth for your REST API. By default, auth is disabled.

{
auth: {
iam: true
}
}

auth.cognito?

Type Input<Object>

Enable Cognito User Pool authorization for a given API route.

You can configure JWT auth.

{
auth: {
cognito: {
authorizer: myAuthorizer.id,
scopes: ["read:profile", "write:profile"]
}
}
}

Where myAuthorizer is:

const userPool = new aws.cognito.UserPool();
const myAuthorizer = api.addAuthorizer({
name: "MyAuthorizer",
userPools: [userPool.arn]
});
auth.cognito.authorizer

Type Input<string>

Authorizer ID of the Cognito User Pool authorizer.

auth.cognito.scopes?

Type Input<Input<string>[]>

Defines the permissions or access levels that the authorization token grants.

auth.custom?

Type Input<string>

Enable custom Lambda authorization for a given API route. Pass in the authorizer ID.

{
auth: {
custom: myAuthorizer.id
}
}

Where myAuthorizer is:

const userPool = new aws.cognito.UserPool();
const myAuthorizer = api.addAuthorizer({
name: "MyAuthorizer",
userPools: [userPool.arn]
});

auth.iam?

Type Input<true>

Enable IAM authorization for a given API route.

When IAM auth is enabled, clients need to use Signature Version 4 to sign their requests with their AWS credentials.

handler

Type Input<string | FunctionArgs>

The route function.

method

Type string

The route method.

path

Type string

The route path.

resourceId

Type Input<string>

The route resource ID.

transform?

Type Object

Transform how this component creates its underlying resources.

transform.integration?

Type IntegrationArgs | (args: IntegrationArgs, opts: ComponentResourceOptions, name: string) => void

Transform the API Gateway REST API integration resource.