Skip to content
v2.278.0

LambdaAuthorizerConfigProperty Struct ​

Configuration for AWS Lambda function authorization.

Example ​

ts
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import { aws_appsync as appsync } from 'aws-cdk-lib';
const lambdaAuthorizerConfigProperty: appsync.CfnGraphQLApi.LambdaAuthorizerConfigProperty = {
  authorizerResultTtlInSeconds: 123,
  authorizerUri: 'authorizerUri',
  identityValidationExpression: 'identityValidationExpression',
};
python
# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
from aws_cdk import aws_appsync as appsync

lambda_authorizer_config_property = appsync.CfnGraphQLApi.LambdaAuthorizerConfigProperty(
    authorizer_result_ttl_in_seconds=123,
    authorizer_uri="authorizerUri",
    identity_validation_expression="identityValidationExpression"
)
java
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import software.amazon.awscdk.services.appsync.*;

LambdaAuthorizerConfigProperty lambdaAuthorizerConfigProperty = LambdaAuthorizerConfigProperty.builder()
        .authorizerResultTtlInSeconds(123)
        .authorizerUri("authorizerUri")
        .identityValidationExpression("identityValidationExpression")
        .build();
csharp
// Install: dotnet add package Amazon.CDK.Lib
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
using Amazon.CDK.AWS.AppSync;

var lambdaAuthorizerConfigProperty = new LambdaAuthorizerConfigProperty {
    AuthorizerResultTtlInSeconds = 123,
    AuthorizerUri = "authorizerUri",
    IdentityValidationExpression = "identityValidationExpression"
};
go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import "github.com/aws/aws-cdk-go/awscdk"

lambdaAuthorizerConfigProperty := &LambdaAuthorizerConfigProperty{
	AuthorizerResultTtlInSeconds: jsii.Number(123),
	AuthorizerUri: jsii.String("authorizerUri"),
	IdentityValidationExpression: jsii.String("identityValidationExpression"),
}

Properties ​

authorizerResultTtlInSecondsoptionalnumberauthorizer_result_ttl_in_secondsoptionalint | floatauthorizerResultTtlInSecondsoptionalNumberAuthorizerResultTtlInSecondsoptionaldoubleAuthorizerResultTtlInSecondsoptional*float64 #
The number of seconds a response should be cached for.
notes

The default is 0 seconds, which disables caching. If you don't specify a value for authorizerResultTtlInSeconds , the default value is used. The maximum value is one hour (3600 seconds). The Lambda function can override this by returning a ttlOverride key in its response.

authorizerUrioptionalstringauthorizer_urioptionalstrauthorizerUrioptionalStringAuthorizerUrioptionalstringAuthorizerUrioptional*string #
The ARN of the Lambda function to be called for authorization.
notes

This may be a standard Lambda ARN, a version ARN ( .../v3 ) or alias ARN.

Note : This Lambda function must have the following resource-based policy assigned to it. When configuring Lambda authorizers in the console, this is done for you. To do so with the AWS CLI , run the following:

aws lambda add-permission --function-name "arn:aws:lambda:us-east-2:111122223333:function:my-function" --statement-id "appsync" --principal appsync.amazonaws.com --action lambda:InvokeFunction

identityValidationExpressionoptionalstringidentity_validation_expressionoptionalstridentityValidationExpressionoptionalStringIdentityValidationExpressionoptionalstringIdentityValidationExpressionoptional*string #
A regular expression for validation of tokens before the Lambda function is called.