aws-cdk-lib.aws_apigateway.LambdaAuthorizerProps

interface LambdaAuthorizerProps

LanguageType name
.NETAmazon.CDK.AWS.APIGateway.LambdaAuthorizerProps
Gogithub.com/aws/aws-cdk-go/awscdk/v2/awsapigateway#LambdaAuthorizerProps
Javasoftware.amazon.awscdk.services.apigateway.LambdaAuthorizerProps
Pythonaws_cdk.aws_apigateway.LambdaAuthorizerProps
TypeScript (source)aws-cdk-lib » aws_apigateway » LambdaAuthorizerProps

Base properties for all lambda authorizers.

Example

// 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

NameTypeDescription
handlerIFunctionThe handler for the authorizer lambda function.
assumeRole?IRoleAn optional IAM role for APIGateway to assume before calling the Lambda-based authorizer.
authorizerName?stringAn optional human friendly name for the authorizer.
resultsCacheTtl?DurationHow long APIGateway should cache the results.

handler

Type: IFunction

The handler for the authorizer lambda function.

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.


assumeRole?

Type: IRole (optional, default: A resource policy is added to the Lambda function allowing apigateway.amazonaws.com to invoke the function.)

An optional IAM role for APIGateway to assume before calling the Lambda-based authorizer.

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


authorizerName?

Type: string (optional, default: the unique construct ID)

An optional human friendly name for the authorizer.

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


resultsCacheTtl?

Type: Duration (optional, default: Duration.minutes(5))

How long APIGateway should cache the results.

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