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 Amazon 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 to use for the route.

api.executionArn

Type Input<string>

The execution ARN of the api.

api.id

Type Input<string>

The ID of the api.

api.name

Type Input<string>

The name of the api.

auth?

Type Input<Object>

Enable auth for your REST API.

{
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.

handlerTransform?

Type FunctionArgs | (args: FunctionArgs => void)

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 => void)

Transform the API Gateway HTTP API integration resource.

transform.route?

Type RouteArgs | (args: RouteArgs => void)

Transform the API Gateway HTTP API route resource.