Use existing cognito userpool created outside cloudformation in trigger for lambda

Unfortunately CloudFormation doesn’t support adding federation providers to a cognito userpool, so I have to manually create the pool in the console. I need to utilize a lambda trigger offered by that pool, but I can’t find any way to reference the preexisting userpool with serverless.

Alternatively, if I could create the cognito pool inside serverless.yml and have any modifications I make in the console not be overridden when I redeploy, that would work too. Is that possible?

The Lambda triggers for your Cognito User Pool are part of the Cognito User Pool configuration in CloudFormation so you can’t use a preexisting user pool as an event source for a function setup in serverless. There may be a third party plugin to allow you to work around this (I haven’t looked) that will update the user pool after the functions have been deployed.

You may be able to create your user pool via CloudFormation then modify it manually without those change be overriden during the next deployment. I’ve been able to do that with some (but not all) settings. The only way to know for sure is to test it.