serverless-application-model icon indicating copy to clipboard operation
serverless-application-model copied to clipboard

Support existing UserPools

Open mousedownmike opened this issue 5 years ago • 2 comments

Description: I would like to manage a Cognito custom messages Lambda function using SAM for an existing User Pool that is defined elsewhere (not in CloudFormation or SAM).

The current Cognito event source only accepts a UserPool reference "defined in the same template".

Would it be possible to add a UserPoolId that could be used in place of UserPool to address an existing pool and assign the SAM managed Lambda to that pool?

mousedownmike avatar Nov 20 '20 16:11 mousedownmike

I stumbled upon this looking for an answer to my problem - is it really not supported?

JacekAdamczyk avatar Oct 02 '21 17:10 JacekAdamczyk

This is currently not possible. In the current Cognito event source, Trigger is a required property and once set, it will update LambdaConfig property of the UserPool. If UserPool is in another template, there would be no way to update LambdaConfig property.

The only way is to allow not specifying Trigger property in SAM Function. However if that's the case, there is really no point to use Cognito event source anymore. You can just define a standalone AWS::Serverless::Function, AWS::Lambda::Permission, and a AWS::Cognito::UserPool resource.

GavinZZ avatar Oct 25 '23 20:10 GavinZZ