I have Cognito pool in account (11111111) with a lambda trigger for PreSignUp where the lambda function is in account (22222222). Im able to create the Cognito pool successfully however when I try to execute an action such as CreateUser I get the error UnexpectedLambdaException: PreSignUp invocation failed due to configuration.
I've updated the lambda resource policy to allow cross account access with the following statements:
{
"Sid": "xaccount",
"Effect": "Allow",
"Principal": {
"AWS": "arn:aws:iam::11111111:root"
},
"Action": "lambda:InvokeFunction",
"Resource": "arn:aws:lambda:us-west-2:22222222:function:my-function"
}
and
{
"Sid": "AllowCognitoInvoke",
"Effect": "Allow",
"Principal": {
"Service": "cognito-idp.amazonaws.com"
},
"Action": "lambda:InvokeFunction",
"Resource": "arn:aws:lambda:us-west-2:22222222:function:my-function",
"Condition": {
"ArnLike": {
"AWS:SourceArn": "arn:aws:cognito-idp:us-east-1:11111111:userpool/*"
}
}
}
Not sure what other configuration Im missing. Has anyone successfully setup something similar before?