Support existing UserPools
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?
I stumbled upon this looking for an answer to my problem - is it really not supported?
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.