Skip to content
v2.273.0

LambdaAuthorizerProps Struct ​

Base properties for all lambda authorizers.

Example ​

ts
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import * as cdk from 'aws-cdk-lib';
import { aws_apigateway as apigateway } from 'aws-cdk-lib';
import { aws_iam as iam } from 'aws-cdk-lib';
import { aws_lambda as lambda } from 'aws-cdk-lib';

declare const function_: lambda.Function;
declare const role: iam.Role;
const lambdaAuthorizerProps: apigateway.LambdaAuthorizerProps = {
  handler: function_,

  // the properties below are optional
  assumeRole: role,
  authorizerName: 'authorizerName',
  resultsCacheTtl: cdk.Duration.minutes(30),
};

Properties ​

assumeRoleIRoleassume_roleIRoleassumeRoleIRoleAssumeRoleIRoleAssumeRoleIRole= A resource policy is added to th…#
An optional IAM role for APIGateway to assume before calling the Lambda-based authorizer.

The IAM role must be assumable by 'apigateway.amazonaws.com'.

default

Default: A resource policy is added to the Lambda function allowing apigateway.amazonaws.com to invoke the function.

authorizerNamestringauthorizer_namestrauthorizerNameStringAuthorizerNamestringAuthorizerName*string= the unique construct ID#
An optional human friendly name for the authorizer.

Note that, this is not the primary identifier of the authorizer.

handlerIFunctionhandlerIFunctionhandlerIFunctionHandlerIFunctionHandlerIFunctionrequired#
The handler for the authorizer lambda function.
notes

The handler must follow a very specific protocol on the input it receives and the output it needs to produce. API Gateway has documented the handler's input specification and output specification.

resultsCacheTtlDurationresults_cache_ttlDurationresultsCacheTtlDurationResultsCacheTtlDurationResultsCacheTtlDuration= Duration.minutes(5)#
How long APIGateway should cache the results.

Max 1 hour. Disable caching by setting this to 0.