Description
Describe the feature
Lambda Provisioned Concurrency can be configured only against a function version or alias, so we wondered what alias/version gets invoked by Cognito for auth triggers. Quoting the AWS Doc:
You can't declare a function version in your Lambda trigger configuration. Amazon Cognito user pools invoke the latest version of your function by default. However, you can associate a function version with an alias and set your trigger LambdaArn to the alias ARN in a CreateUserPool or UpdateUserPool API request.
AWS CDK's .addTrigger
currently does not support specifying a function ALIAS to invoke:
addTrigger(operation: UserPoolOperation, fn: lambda.IFunction, lambdaVersion?: LambdaVersion): void;
Use Case
The use case is being able to use Lambda Provisioned Concurrency for our triggers.
In particular, the PreTokenGeneration
trigger is crucial. When the Lambda requires access to the VPC to handle requests, the cold-start takes 5-8 seconds. It is an unacceptable amount of time to wait for a sign-in or session renewal in 2025.
Proposed Solution
The UserPool's .addTrigger
should support specifying a function ALIAS. It should not be mandatory, and could default to $LATEST
(which would be the same than not specifying it at all, like I guess it is right now).
addTrigger(operation: UserPoolOperation, fn: lambda.IFunction, lambdaVersion?: LambdaVersion): void;
Other Information
No response
Acknowledgements
- I may be able to implement this feature request
- This feature might incur a breaking change
AWS CDK Library version (aws-cdk-lib)
2.193.0
AWS CDK CLI version
2.1012.0
Environment details (OS name and version, etc.)
Mac OS 14.6.1